At 2003-08-18 16:17 -0400, Dan Anderson wrote:
>I need to grab cookies from a web page and pass those cookies back to
>the web page when needed.  I downloaded the cURL program and was playing
>with it, but don't understand how cURL functions correlate into the PHP
>equivalents.

I don't know cURL, but when you want to get the cookies that
a server sends, whilst sending a page, I think you need to
use the fsockopen() function and send a proper GET or HEAD
or whatever command (see the manual under fsockopen).
This way, you'll also get the header of the HTML file
that is being send to you and that is what contains the
cookies.

>How would I strip the cookies from a web page, and send cookies?

You'd strip the cookies by interpreting the appropriate lines.

To send cookies, put them in the header of the GET request
that I described above. (But of the next request of course.)

>More importantly, if I have cookies from domain x which provides y
>cookies and go to a second web page from domain x which provides z
>cookies, if I go to another web page on domain x should I concatanate
>the y and z cookies, or just send the last z cookies recieved?

Cookies themselves specify to which documents on other parts
of the domain they should be returned. It's quite complicated.
Look for a link to the Netscape specification about this in
the PHP manual under cookies, header() etc.

Success!
Jaap

PS. I have also been fighting the cookie-monster again today! ;-)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to