curl-library
Re: behind the scenes of CURLOPT-commands?
Date: Fri, 19 Nov 2010 23:46:40 +0200
Hi
On 19 November 2010 14:31, Bobo Wieland <bobo_at_prisjakt.nu> wrote:
> Hi (first post).
>
> I need to do the equivalent of the following php-code using cURL directly:
>
> $ch = curl_init($posturl);
> curl_setopt($ch, CURLOPT_POST, 1);
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPOST
> curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTPOSTFIELDS
> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
> curl_setopt($ch, CURLOPT_HEADER, 1);
> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
etc.
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
This one looks like it might be invented by the PHP bindings author.
I have no idea what it does.
> I can't figure out everything and I canät find a guide online.
See the curl_easy_setopt page (mentioned above) and also the examples here:
http://curl.haxx.se/libcurl/c/example.html
and the tutorial here:
http://curl.haxx.se/libcurl/c/libcurl-tutorial.html
Note also that if you know how to do what you want with the "curl"
command line utility, you can do this:
curl --your --options --here http://www.example.com/ --libcurl example.c
and example.c will be generated based on the options you choose.
> CURLOPT_FOLLOWLOCATION == --location
> CURLOPT_SSL_VERIFYPEER == --insecure
> CURLOPT_POST == --header "Expect:" //some bug causing it to fail
> otherwize(?)
> CURLOPT_HEADER == --include
> CURLOPT_RETURNTRANSFER == ???
-- Michael Wood <esiotrot_at_gmail.com> ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2010-11-19