cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Getting and passing a cookie...

From: Paperstuff.com <contact_at_paperstuff.com>
Date: Mon, 17 Feb 2003 05:15:09 -0800

Hello again,

Ok, it is 5 am and I just spent 7 hour straight on this. Need to get some sleep... What is really odd is that if I put my password or something in WRONG, it spits out the cookies and I can see them. Yet, if I put the info in correctly, you cannot see the cookies. It looks like there are two. Further, I see I am using 7.9.7. Have things changed to where it explains why this won't work?

The header I provided is the only one. Should there be two or something?

Here is my current code, that looks right, but eBay says, "The browser you're using is rejecting cookies. "

------------------------------------------------------
echo "Getting page...<br>";

$useragent = 'Mozilla/4.0 (compatible; MSIE 6.01; Windows NT 5.0)';
$ch = curl_init('http://cgi3.ebay.com/aw-cgi/eBayISAPI.dll');
$cookiefile = 'cookie.txt';
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_COOKIEJAR, "$cookiefile");
curl_setopt($ch, CURLOPT_COOKIEFILE, "$cookiefile");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL,"http://cgi3.ebay.com/aw-cgi/eBayISAPI.dll");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "MfcISAPICommand=SignInWelcome&userid=USERNAMEHERE&pass=PASSWORDHERE&keepMeSignInOption=1");
$page = curl_exec($ch); // execute the curl command
echo "$page";
curl_cleanup ($ch);

-----------------------------------------------

Aaron Morris

  ----- Original Message -----
  From: Daniel Stenberg
  To: curl and php list
  Sent: Monday, February 17, 2003 4:52 AM
  Subject: Re: Getting and passing a cookie...

  On Sun, 16 Feb 2003, Paperstuff.com wrote:

> We tried to get it to write to the specified file, but it wouldn't write to
> cookies.fil or cookies.txt or the same directory the PHP file was that we
> were using.

  That sounds very odd. COOKIEJAR should create and write the file if it
  recevied one or more cookies.

> Below is eBay's response-header:
>
> ------------------------------------
> Getting page...

> HTTP/1.1 100 Continue Server: Microsoft-IIS/4.0 Date: Mon, 17 Feb 2003
> 06:41:03 GMT HTTP/1.1 302 Object Moved Server: Microsoft-IIS/4.0 Date: Mon,
> 17 Feb 2003 06:41:03 GMT Connection: close Location:
> http://signin.ebay.com/aw-cgi/eBayISAPI.dll?MfcISAPICommand=SignInWelcome&siteid=0&co_partnerId=2&UsingSSL=0&ru=&pp=&pa1=&pa2=&pa3=&i1=-1&pageType=-1&userid=*********&pass=********&keepMeSignInOption=1
> HTTP/1.1 200 OK Server: Microsoft-IIS/4.0 Date: Mon, 17 Feb 2003 06:41:03
> GMT Connection: close Content-Type: text/html HTTP/1.1 200 OK Server:
> Microsoft-IIS/4.0 Date: Mon, 17 Feb 2003 06:41:07 GMT Connection: close
> Content-Type: text/html

  But this doesn't include any cookies? What about showing us your first
  request, the response-headers with the cookies sent back and then your second
  request and its response (headers only is enough)?

> Thank you for any help you can offer or if you know anyone that will do
> this sort of thing for hire. If you are interested, let me know. Have a
> good night,

  Unfortunately, I'm completely lost when it comes to PHP so while I could
  possibly offer a solution in another language, I can't do much good with PHP.

  --
   Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.

  -------------------------------------------------------
  This sf.net email is sponsored by:ThinkGeek
  Welcome to geek heaven.
  http://thinkgeek.com/sf

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-02-17