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+>"
"&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.