cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: From cURL to Lib cURL

From: B Z <bz029_at_hotmail.com>
Date: Tue, 23 Aug 2005 11:54:19 -0700

$ch = curl_init();
                curl_setopt($ch, CURLOPT_COOKIEJAR,
"\Users\Aurobindo\nettemps\cookie.txt");
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
                curl_setopt($ch, CURLOPT_POSTFIELDS,
"account=user&password=pass&dest=http://URL.com");
                curl_setopt($ch, CURLOPT_URL, "http://URL.com/login.html");
                $test = curl_exec($ch);
curl_close($ch);

Awsome! I got it to log in with the above options set. Once I am logged into
xyz website, to navigate through other pages do I need to use a new
curl_init(); or can I simply reset the options after the curl_exec()
command??

I tried making a new curl_init() but it doesnt want to keep me logged in as
I navigate the other pages of the site.

How does PHP/cURLs order of execution work?

Thanks again too all the helpfull people, but especially to Daniel Stenberg
who's name I see a lot =).

~BZ

>From: Daniel Stenberg <daniel-curl_at_haxx.se>
>Reply-To: curl tool talk <curl-users_at_cool.haxx.se>
>To: curl tool talk <curl-users_at_cool.haxx.se>
>Subject: Re: From cURL to Lib cURL
>Date: Tue, 23 Aug 2005 20:04:28 +0200 (CEST)
>
>On Tue, 23 Aug 2005, B Z wrote:
>
>>So when I finally got comfortable with using curl commands, now I have a
>>need to use it within PHP - using LibcURL.
>
>We call it PHP/CURL - the particular libcurl binding you access with PHP.
>libcurl is the underlying lib written in C.
>
>>curl -c /User/Aurobindo/nettemps/cookie.txt -L
>>http://desk.net-temps.com/login.html -d account=user -d password=pass -d
>>dest="http://desk.net-temps.com"
>
>>curl_setopt($ch, CURLOPT_COOKIEFILE,
>>"\User\Aurobindo\nettemps\cookie.txt");
>>curl_setopt($ch, CURLOPT_POSTFIELDS,
>>"account=user&password=pass&dest=http://desk.net-temps.com");
>>curl_setopt($ch, CURLOPT_URL, "http://desk.net-temps.com/login.html");
>
>1. You didn't "translate" -L! It should be CURLOPT_FOLLOWLOCATION set to a
> non-zero value.
>
>2. -c translates to CURLOPT_COOKIEJAR not CURLOPT_COOKIEFILE
>
>--
> Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-08-23