Thread: Login Program

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    12

    Post eBay Login Program

    Hi,
    well what I am trying to achieve, is to develope a program that can
    log into my eBay account.

    I was sure that they would use some weird ways to pass the login names and so on, but I didn't think it would be this hard to realize or to figure out.
    Well what I have done so far is to connect to ebay send them a POST with the login data and some more stuff they require and then download the html source of the page I get redirected to. But I don't get further than the part before the redirection.

    I have used this code on different pages and it works there but I just can't figure this out.

    I'm using cUrl for internet code (e.g. downloading source to memory, send POSTs, etc.)

    Code:
    #include <stdio.h>
    #include <curl.h>
    
    ...
    
    int main(void)
    {
      CURL *curl;
      CURL *curl2;
      CURLcode res;
      
      FILE *file = fopen("test.txt", "w");
      
      struct MemoryStruct chunk;
    
      chunk.memory=NULL; /* we expect realloc(NULL, size) to work */
      chunk.size = 0;    /* no data at this point */
    
      curl_global_init(CURL_GLOBAL_ALL);
    
      curl = curl_easy_init();
      curl2 = curl_easy_init();
      
      /* First set the URL that is about to receive our POST. This URL can
         just as well be a https:// URL if that is what should receive the
         data. */
      curl_easy_setopt(curl, CURLOPT_URL, "http://www.ebay.de");
      
      /* Now specify additional HTTP Header data */
      //curl_easy_setopt(curl, CURLOPT_HTTPHEADER, 
            "Location: /eBayISAPI.dll?MyEbaySellingSoldListings"
            "&ssPageName=STRK:ME:LNLK");
    
      /* Now specify the POST data */
      curl_easy_setopt(curl, CURLOPT_POSTFIELDS, 
            "MfcISAPICommand=SignInWelcome&siteid=77"
            "&co_partnerId=2&UsingSSL=1"
            "&ru=http%3a%2f%2fmy%2eebay%2ede%3a80%2fws%2feBay"
            "ISAPI%2edll%3fMyeBay"
            "&ssPageName=h%3Ah%3Amebay%3ADE&i1=%2d1&pageType=1883"
            "&userid=EBAY_LOGIN_NAME&pass=PASSWORD&signinButton=Sicheres+Einloggen+&gt;"
            "&keepMeSignInOption=1");
    
      /* some servers don't like requests that are made without a user-agent
         field, so we provide one */
      curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
      
      //curl_easy_setopt(curl, CURLOPT_HTTPGET,
             "ws/eBayISAPI.dll?MyEbaySellingSoldListings&ssPageName=STRK:ME:LNLK");
      
      /* send all data to this function  */
      curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
    
      /* we pass our 'chunk' struct to the callback function */
      curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
      
      /* get it! */
      curl_easy_perform(curl);
    
      /* always cleanup */
      curl_easy_cleanup(curl);
     
      printf("%d", sizeof(chunk.size));
      system("pause");
      fprintf(file, "%s", chunk.memory);
      system("pause");  
      //fprintf(
      return 0;
    }
    Have any of you tried/done anything like this?
    Any information or tips are appreciated.
    Last edited by tboy; 12-03-2004 at 09:40 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,662
    Easiest thing to do is grab a copy of ethereal (www.ethereal.com) and use it to watch what your browser does.
    Then do the same thing in your curl program.

  3. #3
    </life>
    Join Date
    Oct 2004
    Posts
    83
    Keep in mind that alot of sites will not allow you to send login information unless it sent from the website itself. This could well be the case with a large site such as ebay.

    Hint, make your program behave like a browser.
    Microsoft is merely an illusion, albeit a very persistant one.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Login Form for program
    By Houssen in forum C++ Programming
    Replies: 3
    Last Post: 03-29-2008, 02:35 PM
  2. simple login program problem
    By suckss in forum C Programming
    Replies: 11
    Last Post: 11-11-2006, 05:02 PM
  3. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  4. my server program auto shut down
    By hanhao in forum Networking/Device Communication
    Replies: 1
    Last Post: 03-13-2004, 10:49 PM
  5. redirection program help needed??
    By Unregistered in forum Linux Programming
    Replies: 0
    Last Post: 04-17-2002, 05:50 AM