asked on
ASKER
$get_cookie_page = 'http://www.google.com';
echo curl_download($get_cookie_page);
function curl_download($Url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
$http_headers = array(
'Host: www.google.ca',
'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2',
'Accept: */*',
'Accept-Language: en-us,en;q=0.5',
'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Connection: keep-alive'
);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $http_headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
HTTP/1.1 200 OK
Date: Wed, 12 Apr 2017 20:49:05 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=UTF-8
P3P: CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info."
Server: gws
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Set-Cookie: NID=101=vVz6x8dP2GHQPhu6gJsceLoGnOUKiznAiLkZg0E2BzlCf2fBxKUhGd0E9S1i6CouwdhZM4ZiL5LXEWSPwqPO56OGJumvTh9ZQRPYNUhwI7mNciKDytpDffNV_EassdYd; expires=Thu, 12-Oct-2017 20:49:05 GMT; path=/; domain=.google.ca; HttpOnly
Transfer-Encoding: chunked
Accept-Ranges: none
Vary: Accept-Encoding
ASKER
ASKER
ASKER
ASKER
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_.twitter.com TRUE / TRUE 0 _twitter_sess BAh7CSIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%250ASGFzaHsABjoKQHVzZWR7ADoPY3JlYXRlZF9hdGwrCEpWL2RbAToMY3NyZl9p%250AZCIlNDczNjk0OGQxYjM1OUQ1NjljODQwNjUxNWRjMTAmYTU6B2lkIiU2N2Y3%250AZjQxMTdkY2FmYTg0ZGQwZmY5N2Q0YTY0NTk4Zg%253D%253D--daf4db39fd5de201758349f3bebc6cc804db09aa
twitter.com FALSE / FALSE 1492639275 external_referer padhuUp36zjgzgv1mFWxJ8aHbAM%2FyKh7|0|8e8t2xd8A2w%3D
.twitter.com TRUE / TRUE 1492056075 ct0 5474a0a90005bd1a1361874852350b34
.twitter.com TRUE / FALSE 1555106475 guest_id v1%3A149203446559252039
However when I cURL https://www.cedexis.com/products/radar/ I do not get any cookies. I noticed that with cookies turned off in Firefox, the page is reported to be insecure, even though it's HTTPS. It may be that cURL does not like the changes that Cedexis is doing? Here's a screen shot of the cookie names they set.public function __construct($href, $user=NULL, $pass=NULL, $get_array=[], $title=NULL)If this is causing a parse error, it means you're running a dangerously out-of-date version of PHP. PHP7 versions are the only ones that are supported today. The new array notation using square brackets was introduced in one of the PHP5 releases.
ASKER
ASKER
ASKER
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_.experts-exchange.com TRUE / FALSE 1523648872 __cfduid dd77e5ff755d33da9ee06ae7fdd18ca7c1492112872
#HttpOnly_www.Experts-Exchange.com FALSE / FALSE 0 JSESSIONID 0D238DEC084E78ACD02F616DF9E3D0D9
.www.experts-exchange.com TRUE / TRUE 3639596520 CC_0 "OE=j1gth8r1:j1gth8r1&VTCT=1&exp_rs_1161=LO_REG&exp_r_162=exp_rs_1161"
#HttpOnly_www.Experts-Exchange.com FALSE / FALSE 0 AWSELB C92B9F45167AF63E26ED5CB181FE9F92011716F33629D2F6AAA18745709E160BDA07DB75A75A98E2393A9BE60320C6672EE57A66871DB88E007B56E04C85085E76F34CB5AF921BC6A737753A0A3F8887530A7B3DBB
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
From this design, it is obvious that HTTP cookies are potentially variable in a 1:1 ratio to the number of client HTTP requests. In practice that is rarely the case, but if you want to account for all the cookies, you have to account for all of the possible paths that a client might take as they browse the web site. In a shopping site, this might be quite a lot of paths.
It's also worth knowing that the cookie itself carries very little information - just a link to an information set that is stored on the server.
Writing a cURL script that will follow all of the links in a web site is computationally trivial, but running the script may be resource-intensive. I tried several PHP solutions for web site search about a decade ago and never found any PHP-based spider that could run very fast. That aside, as each of the links is followed (via cURL), you can tell cURL to collect the cookies and put them into a "cookie jar." If you use a new cookie jar for each page load, you can keep track of which page set which cookie.
The browser will return cookies to the server on the basis of a domain and/or a subdomain. So cookies from Google.com are not returned to Facebook.com, and it's possible that cookies from example.com are not returned to www.example.com. But this is the tip of the iceberg. The cookies and associated information may be shared in a variety of ways that are not evident in the HTTP protocol. To see this in action, visit EBay.com and make a search for "copper stock pot." Then visit Amazon.com and see what comes up in the suggestions feed.
I don't think cookiepedia is scanning web sites, so much as it's trying to aggregate information from a human client base about the cookies they have found on their browsers. I'm not sure this will be very fruitful, because (at least for me) I don't care what cookies get put on my browser; I delete the cookies from time to time; I'm not aware of any value proposition that would encourage me to give my information to cookiepedia.
Coming at the cookies from another angle, I can see all of the cookies on my browser (most browsers have such a feature). But getting to these cookies without personal, human, intervention is impossible. For the most part, servers can only see the cookies that are applicable to the individual server. I would have no way of knowing your browser history, and a server cannot initiate communication with a client browser.