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

curl-and-php

Re: curl sessions

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 10 Dec 2002 13:39:14 +0100 (MET)

On Mon, 9 Dec 2002, Joe Bassi wrote:

Please, don't mail me privately with curl questions. This reply is cc'ed to
the curl and php list, take follow-ups there!

See more at http://curl.haxx.se/mail/etiquette.html

> $ch = curl_init();
>
> curl_setopt($ch, CURLOPT_URL,"http://localhost/");
> curl_setopt($ch, CURLOPT_POST, 0);
> curl_setopt($ch, CURLOPT_POSTFIELDS, "command=login&username=user&password=pass");
>
> $result = curl_exec ($ch);
> curl_close ($ch);
>
> echo "Result: ".$result;
>
> This code works fine that it logs me in to the login page, but when I click
> on a link in the result page, I get a session expired error. I even tried
> it by commenting out the curl_close function, but still no luck. Is there
> any way I can keep my http session using these curl functions and be able
> to redirect to another page from the result page.

You need to understand that curl gets the HTML for you. That's basicly all.
If you output the HTML from the remote site, making it appear as if it was
your local stuff, then yes it may very well not work.

Then you need to do somthing about it.

Most likely, you should translate all URLs in the HTML to go through some
local script on your site that can perform some magic to make them work.

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-12-10