cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: I can't post data to a url

From: Schneider John <John.Schneider_at_sentry.com>
Date: Mon, 6 Jun 2005 07:33:24 -0500

You can set it to whatever you know to be valid if you wish:

   struct curl_slist *curlHeader = NULL;
   curlHeader = curl_slist_append(curlHeader, "Content-Type: xxxxxxx");
   curl_easy_setopt(curlHandle, CURLOPT_HTTPHEADER, curlHeader);

(replace xxxxxxx with whatever works)
 - John
 

-----Original Message-----
From: curl-users-bounces_at_cool.haxx.se
[mailto:curl-users-bounces_at_cool.haxx.se] On Behalf Of kl rao
Sent: Saturday, June 04, 2005 5:16 AM
To: curl-users_at_cool.haxx.se
Subject: I can't post data to a url

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

This e-mail is confidential. If you are not the intended recipient, you must not disclose or use the information contained in it. If you have received this e-mail in error, please tell us immediately by return e-mail to Email.Control_at_sentry.com and delete the document.

E-mails containing unprofessional, discourteous or offensive remarks violate Sentry policy. You may report employee violations by forwarding the message to Email.Control_at_sentry.com.

No recipient may use the information in this e-mail in violation of any civil or criminal statute. Sentry disclaims all liability for any unauthorized uses of this e-mail or its contents.

This e-mail constitutes neither an offer nor an acceptance of any offer. No contract may be entered into by a Sentry employee without express approval from an authorized Sentry manager.

Warning: Computer viruses can be transmitted via e-mail. Sentry accepts no liability or responsibility for any damage caused by any virus transmitted with this e-mail.
Received on 2005-06-06