[newbie] Sucking site: How to handle cookies?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

    There's a site I like that doesn't support RSS, so I'd like to
write a PHP script that my RSS client can call, that will connect to
the site, authenticate through a POST message, suck the page that
shows the new articles, open each article and grab contents through
regexes, and then disconnect.

Problem is, the site uses a PHPSESSID cookie to keep track of who the
reader is from page to page.

Is there a tool in PHP that can grab web pages and store cookies to
keep the remote site happy?

Thank you.

Re: [newbie] Sucking site: How to handle cookies?

Quoted text here. Click to load it

For those interested in doing the same kind of thing, it seems like
Libcurl is the way to go:



Re: [newbie] Sucking site: How to handle cookies?

Gilles Ganault schrieb:
Quoted text here. Click to load it

You can send cookies and even POST parameters with fsockopen(), if  
libcurl isn't installed in your version of PHP. Of course, fsockopen()  
isn't http-specific, so you'd have to format the request and parse the  
response yourself.

Personally, I love the HTTP client implemented by the Drupal CMS. It's a  
single function, short, powerful, and can handle http and https equally.

Since it uses only PHP library functions (as opposed to other functions  
defined by Drupal), it can easily be copied into a separate script file  
and included by your application:


(Drupal is under the GPL, and given that you're spidering the site for  
your personal use anyway, I doubt there are any issues with that.)


Re: [newbie] Sucking site: How to handle cookies?

On Wed, 13 Jun 2007 14:12:46 +0200, Christoph Burschka
Quoted text here. Click to load it

Thanks for the link.

Site Timeline