cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: From cURL to Lib cURL

From: Daniel Stenberg <daniel-curl_at_haxx.se>
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