cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Curl and eBay-Login

From: Frank Hempel <red_socks_at_gmx.de>
Date: Tue, 09 Aug 2005 12:20:15 +0200

Hi Karsten,

ebay is using https for signing in since last year only, so try changing
the urls to https and the post variable "UsingSSL" set to "1".
And dont panic if you only get an ebay response saying your browser is
uncool or something. At the german ebay signin-servers at least, the
response for a successfull signin is such a site, because it has got a
meta refresh in it, so "real" browsers will switch instantly to the
correct "Welcome, you are signed in"-page.

If it still doesnt work check all the post variables whether they are
still correct or depreciated or whatever. eBay is constanly changing
their sites, so the best would be you parse all the post fields every
time from the result you have got from the 1st get-request.

And if it still doesn't work, make a sign in with your browser, then one
try with your application, sniff both network streams with ethereal an
compare. Then you will definetly figure out what is missing... :)

Good luck, Ciao, Frank.

Karsten Stein schrieb:
> Hi,
>
> I’ve writen the eBay-Login-Script in C++ (original: http://curl.haxx.se/libcurl/php/examples/?ex=ebay_login.php ). But if I run this program, I’m getting an error from eBay – your browser reject Cockies. Maybe someone can help me. Here’s the code:
>
> // 1-Get First Login Page http://signin.ebay.com/aw-cgi/eBayISAPI.dll?SignIn
> // This page will set some cookies and we will use them for Posting in Form data.
> char cookie_file_path[] = "f:\\test.txt"; // Please set your Cookie File path
>
> char LOGINURL[] = "http://signin.ebay.com/aw-cgi/eBayISAPI.dll?SignIn&UsingSSL=0&pUserId=XXXXXX&pass=XXXXXXX";
> char agent[] = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
>
> CURL *curl_handle;
> curl_handle = curl_easy_init();
> curl_easy_setopt(curl_handle, CURLOPT_URL, LOGINURL);
> curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, agent);
> curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
> curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, cookie_file_path);
> curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, cookie_file_path);
> curl_easy_perform(curl_handle);
> curl_easy_cleanup(curl_handle);
>
> // 2- Post Login Data to Page http://signin.ebay.com/aw-cgi/eBayISAPI.dll
>
> char LOGINURL2[] = "http://signin.ebay.com/aw-cgi/eBayISAPI.dll";
> char POSTFIELDS[] = "MfcISAPICommand=SignInWelcome&siteid=0&co_partnerId=2&UsingSSL=0&ru=&pp=&pa1=&pa2=&pa3=&i1=-1&pageType=-1&userid=XXXXXXX&pass=XXXXXXXXX&submit=Sign In";
> char reffer[] = "http://signin.ebay.com/aw-cgi/eBayISAPI.dll?SignIn";
>
> curl_handle = curl_easy_init();
> curl_easy_setopt(curl_handle, CURLOPT_URL, LOGINURL2);
> curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, agent);
> curl_easy_setopt(curl_handle, CURLOPT_POST, 1);
> curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, POSTFIELDS);
> curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
> curl_easy_setopt(curl_handle, CURLOPT_REFERER, reffer);
> curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, cookie_file_path);
> curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, cookie_file_path);
> curl_easy_perform(curl_handle);
> curl_easy_cleanup(curl_handle);
>
>
> Curls writes the cookiefile in „f:\\test.txt“:
>
> # Netscape HTTP Cookie File
> # http://www.netscape.com/newsref/std/cookie_spec.html
> # This file was generated by libcurl! Edit at your own risk.
>
> .ebay.com TRUE / FALSE 0 ebay %5Ecv%3D15555%5E
> .ebay.com TRUE / FALSE 1186271978 dp1 bu1p/QEBfX0BAX19AQA**44d3df6a^
> .ebay.com TRUE / FALSE 1154735978 nonsession BAQAAAQVQcELtAAaAAPIAAULzDnAxAMsAAkLysvIxMADKACBMWK1qODNlMWZjMzcxMDUwYTBiNDYxNjQwZTQwZmZmZDYyZTCiSqvqqdlKfLTebrZVuxBGmO+9tA**
>
>
>
> I can also post the HTTP-Header if this is important. It would be a great help If someone can help me ☺
>
> Best regards,
> Karsten Stein
>
>
>
>
>
>
Received on 2005-08-09