views:

571

answers:

4

I can get cookie from the others but not from this site www.dramexchange.com? Anybody know why? Maybe someone can do it with php and curl? :>

$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookieFileName");
curl_setopt($ch, CURLOPT_URL,"http://www.dramexchange.com");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
ob_start();      // prevent any output
curl_exec ($ch); // execute the curl command
ob_end_clean();  // stop preventing output
curl_close ($ch);
unset($ch);
A: 

if you try to get cookie from a ordre website on you own website you can't doe it.

pls tell os what you own domain name is, its easyer to help you.

NeoNmaN
+1  A: 

For whatever reason, http://www.dramexchange.com/index.html isn't sending back a Set-Cookie header.

When I open the page up in a browser, the site sets several cookies (mostly from ad.dramexchange.com), but since curl doesn't fetch every HTTP resource that appears in the page -- it only fetches the one you tell it to -- your request won't retrieve those cookies. You might try retrieving some resources from ad.dramexchange.com, or having wireshark open while you open the site in your browser. Any resource that sends back a cookie will have a Set-Cookie header in its HTTP response headers.

Meredith L. Patterson
A: 

From what I can tell, the URL you give doesn't actually return any cookies:

Cache-Control: private
Date: Sun, 09 Aug 2009 10:44:37 GMT
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Content-Encoding: gzip
Vary: Accept-Encoding
Transfer-Encoding: chunked
Paul Dixon
+1  A: 

It seems to me that all the cookies sent from the public sections of this specific websites come from inline content (banners, web beacons, etc), and most likely are used only for tracking purposes.

If what you want to do is scrape content protected under the log-in, the server might send you a cookie once you issue a POST request to:

login.aspx?ReturnUrl=www.dramexchange.com%2fDefault.aspx

Things you might need to do:

  • Add the curl option CURLOPT_FOLLOWLOCATION in order follow redirects,
  • there are three hidden fields in the login form, you may want to send them as well with your userid and password

(firebug is your friend!)

And