cURL / Mailing Lists / curl-users / Single Mail

curl-users

Plz help me posting data to a url

From: kl rao <rklrao_at_yahoo.co.in>
Date: Wed, 8 Jun 2005 07:26:03 +0100 (BST)

Hi,

    I just have started using libcurl C api. The
following code returning an error: Invalid
Content-Type.
     I could not understand where the problem is. Plz
help me by verifying the code and give me suggestions.

regards,
R.K.L.Rao

****************************************
#include <stdio.h>
#include <curl/curl.h>

  int main(void)
  {
    CURL *curls;
    CURLcode res;
    char *mob;
    char *txt;

    printf("before init");
    curls = curl_easy_init();
    printf("starting");
    mob=(char *)malloc(12);
    txt=(char *)malloc(80);
    printf("malloc ok");
    strcpy(mob,"919849339091");
    strcpy(txt,"this is test");
    printf("strcpy ok");
    if(curls) {

                curl_easy_setopt(curls,
CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
                curl_easy_setopt(curls,
CURLOPT_POSTFIELDS,mob);
                curl_easy_setopt(curls,
CURLOPT_POSTFIELDS,txt);
                curl_easy_setopt(curls,
CURLOPT_POST,1);
               
curl_easy_setopt(curls,CURLOPT_USERPWD,"tester:foobar");
                curl_easy_setopt(curls, CURLOPT_URL,
"http://127.0.0.1:15015/cgi-bin/sendsms");

        res = curl_easy_perform(curls);

      /* always cleanup */
      curl_easy_cleanup(curls);
    }
    return 0;
   }
*************************************

                
_______________________________________________________
Too much spam in your inbox? Yahoo! Mail gives you the
best spam protection for FREE! http://in.mail.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-08