cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: help needed

From: Richard <antonyjones101_at_yahoo.com>
Date: Sun, 2 Apr 2006 14:18:11 +0100 (BST)

Hi Daniel,

The two functions I have written so far to cover this
are :

#define PROPERTYPAGE
"/cgi-bin/clickSq.fcg?rowPos=23&colPos=30"
#define ACTIONPAGE "/cgi-bin/action.fcg"

int property(){
  long httpcode;
  char data[MAXSTR];
  char formdata[MAXSTR],cookiedata[MAXSTR];

  CURLcode res;
  CURL *curl;

  #ifdef VERBOSE
  fprintf(stdout,"property\n");
  #endif //VERBOSE

  curl = curl_easy_init();
  if(!curl) {
        fprintf(stderr,"Error: %s\n","Can't Initialize
CURL");
        return -1;
  }

  InitializeData();
  curl_easy_setopt(curl, CURLOPT_URL, SITE
PROPERTYPAGE);
  curl_easy_setopt(curl, CURLOPT_COOKIEFILE,
COOKIEFILE);
  sprintf(cookiedata,"%s=%s","sessionId",sessionid);
  curl_easy_setopt(curl, CURLOPT_COOKIE, cookiedata);
  curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
fwrite);
  curl_easy_setopt(curl, CURLOPT_WRITEDATA,
getDataFile());
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);

  res = curl_easy_perform(curl);
  if(res!=CURLE_OK) {
    fprintf(stderr,"Error:
%s\n",curl_easy_strerror(res));
    CloseData();
    curl_easy_cleanup(curl);
    return -1;
  }

  CloseData();

  curl_easy_cleanup(curl);

  return 0;
}

int takeover(){
  long httpcode;
  char data[MAXSTR];
  char formdata[MAXSTR],cookiedata[MAXSTR];

  CURLcode res;
  CURL *curl;

  #ifdef VERBOSE
  fprintf(stdout,"takeover\n");
  #endif //VERBOSE

  curl = curl_easy_init();
  if(!curl) {
        fprintf(stderr,"Error: %s\n","Can't Initialize
CURL");
        return -1;
  }

  InitializeData();
curl_easy_setopt(curl, CURLOPT_REFERER, SITE
PROPERTYPAGE);
  curl_easy_setopt(curl, CURLOPT_URL, SITE
ACTIONPAGE);
  curl_easy_setopt(curl, CURLOPT_COOKIEFILE,
COOKIEFILE);
  curl_easy_setopt(curl, CURLOPT_POST, TRUE);
 
strcpy(formdata,"action=takeover&rowPos=23&colPos=30&type=14");

  curl_easy_setopt(curl, CURLOPT_POSTFIELDS,
formdata);
  sprintf(cookiedata,"%s=%s","sessionId",sessionid);
  curl_easy_setopt(curl, CURLOPT_COOKIE, cookiedata);
  curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
fwrite);
  curl_easy_setopt(curl, CURLOPT_WRITEDATA,
getDataFile());
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);

  res = curl_easy_perform(curl);
  if(res!=CURLE_OK) {
    fprintf(stderr,"Error:
%s\n",curl_easy_strerror(res));
    CloseData();
    curl_easy_cleanup(curl);
    return -1;
  }

  CloseData();

  curl_easy_cleanup(curl);

  return 0;
}

But it doesn't seem to like it :/
--- Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Sat, 1 Apr 2006, Richard wrote:
>
> > I need to recreate the following in curl but
> having trouble writing the
> > correct functions :o(
>
> And what did you try to far? Seem to be a "plain"
> case of using -d, -b, -c and
> -L.
>
> --
> Commercial curl and libcurl Technical Support:
> http://haxx.se/curl.html
>

        
        
                
___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
Received on 2006-04-02