cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: full URL on POST requests

From: Alexandre BM <salexandre.bm_at_gmail.com>
Date: Sun, 24 Jun 2012 11:15:13 +0100

On 24/06/2012 07:41, Jorgyano Vieira wrote:
> Hello,

Hello,

>
> Im trying to send a HTTP request of type:
>
> ---- Example 1 -------
> POST http://example.com/something?var=foo&var2=bar <==== host Entire URL
> Accept: */*
> Accept-Language: en-us
> Host: example.com
> * * *
> * * *
> * * *
> DATA
> ----
>
> Using libcurl, until now I only can sen the request like this:
>
> ---- Example 2 -------
> POST /something?var=foo&var2=bar <==== host omitted
> Accept: */*
> Accept-Language: en-us
> Host: example.com
> * * *
> * * *
> * * *
> DATA
> ----
>
> is there any way to send the entire URL on POST command like example 1?
>

try this :

 curl_easy_setopt(handle,CURLOPT_URL,"http://example.com/something");
 curl_easy_setopt(handle,CURLOPT_POSTFIELDS,"var=foo&var2=bar");
 curl_easy_setopt(handle,CURLOPT_POST,1);

>
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-06-24