Yesterday at 6:34pm, Richard Miller said:

>CLI CURL:
...
>Cookie: WSJIE_LOGIN=xyz
...
>Cookie: fastlogin=xyz; wsjproducts=xyz; user_type=xyz; REMOTE_USER=xyz;
>UBID=xyz
>
>PHP CURL:
...
>Cookie: WSJIE_LOGIN=xyz
...
>The PHP version of curl doesn't send a User-Agent line, which I suppose
>is fine.  I could mimic the other one if necessary.  The problems
>appears to be that the 5 cookies weren't sent.  Why wouldn't PHP's curl
>send those 5 cookies?  By the way, I didn't set those cookies; the
>server did.  Without those cookies, the redirection gets stuck in an
>infinite loop and the content page never loads.  Help?!

I think you're right about the User-Agent. Shouldn't matter unless they're
trying to optimize depending on what browser you're using.

I also think you're right about the five extra cookies being the problem.
I haven't used curl enough yet to say why the CLI curl picks them up and
the PHP one doesn't, but I would guess that if you add all five cookies in
your PHP source, it would likely work. Namely, change this:

>> DOESN'T WORK:
>>      $url = "http://online.wsj.com/home/us";;
>>      $filename = "wsj.html";
>>      $mycookie = "blahblahblah";

To this:

      $url = "http://online.wsj.com/home/us";;
      $filename = "wsj.html";
      $mycookie = "WSJIE_LOGIN=xyz; fastlogin=xyz; wsjproducts=xyz; ".
                  "user_type=xyz; REMOTE_USER=xyz; UBID=xyz";

Then you should see the PHP curl sending all six cookies when you watch
it with your sniffer, and with any luck, you should see the right page.

Mac

--
Mac Newbold             MNE - Mac Newbold Enterprises, LLC
[EMAIL PROTECTED]       http://www.macnewbold.com/

____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to