curl-and-php
RE: [Cookie] Handle a servlet session.
Date: Fri, 18 Oct 2002 17:40:14 +1000
>
> > I'm mean doing each request with the previous cookie, to simulate a
> > navigation until the right page. The following code is surely wrong, but
> > you get the idea...;-)
> >
> > $ch = curl_init();
> > curl_setopt($ch, CURLOPT_URL,"$LOGINURL");
> > curl_setopt($ch, CURLOPT_COOKIEFILE, 0);
> > curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
> > curl_setopt($ch, CURLOPT_URL,".../page1.jsp");
> > curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
> > curl_setopt($ch, CURLOPT_URL,".../page2.jsp");
> > curl_exec ($ch);
> > curl_close ($ch);
>
>I get your idea, and to repeat what I use to say here, with libcurl itself
>you can do repeated requests using the same libcurl handle which makes things
>like this easier without the need of temporary file storage. The PHP/CURL
>module is however not written to allow that practise.
>
>You need to improve the PHP/CURL code first, or stay with the more simple
>approach of mulitple init/setopt/exec/close iterations.
This does work in PHP. tho it has problems if you use multiple calls to
curl_setopt to set POST data.
If you're doing this its better to use the multiple init approach.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-10-18