cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: I can't post data to a url

From: Marc Champagne <marc.champagne_at_gmail.com>
Date: Sun, 05 Jun 2005 10:02:35 -0400

Although I somewhat new to cURL, it would seem that your postthis= contains a
space between "test" and "message" which should be URI encoded (to a + or %20).

Cheers,
Marc

kl rao wrote:
> Hi everybody,
>
>
> I am new to use curl library. I have written some
> code in 'C' to post data to a url. The program
> responding with error 'Invalid Content-Type'. Plz
> check out this code.. and suggest me changes..
>
> code here:
>
> ----------------------------------------------------------------------------------------------
> #include <stdio.h>
> #include <curl/curl.h>
>
> int main(void)
> {
> CURL *curls;
> CURLcode res;
>
> char *postthis="to=919849339091&text=test
> message";
>
> curls = curl_easy_init();
> if(curls) {
> curl_easy_setopt(curls,
> CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
> curl_easy_setopt(curls,
> CURLOPT_POSTFIELDS,postthis);
>
>
> curl_easy_setopt(curls,CURLOPT_USERPWD,"tester:foobar");
> curl_easy_setopt(curls, CURLOPT_URL,
> "http://127.0.0.1:13013/cgi-bin/sendsms");
>
> res = curl_easy_perform(curls);
>
> curl_easy_cleanup(curls);
> }
> return 0;
> }
>
>
> ----------------------------------------------------------------------------------------------
>
> thanks & regards,
> R.K.L.Rao.
>
>
>
> __________________________________________________________
> How much free photo storage do you get? Store your
> friends 'n family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com
>
>
>
> __________________________________________________________
> How much free photo storage do you get? Store your friends 'n family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com
>
Received on 2005-06-05