cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Curl and eBay-Login

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Tue, 9 Aug 2005 05:16:58 -0500

That ebay_login.php script is dated March 23, 2004. Have you tried it
to see if it still works?? If eBay has altered their login in the
last 16 months, it may not, in which case, any translation of it
probably won't work either.

Right now, if I do a command-line page fetch on the first url you
gave, I get redirected to the secure server and the login form comes
back with 15 input fields, not counting the submit button. The submit
button isn't named, so I think it should not be sent. The original
ebay_login.php only returns 13 fields. The two missing fields
(rtmData & keepMeSignInOption) might be significant. As you're
setting FOLLOW_LOCATION, you'll be ending up at the secure server too,
so you'll probably want to set UsingSSL=1 as well.

If the submit button value *is* supposed to be sent, you should
probably escape the space.

I also get 6 cookies back, which is odd, because you're only showing 3...

Ralph Mitchell

On 8/9/05, Karsten Stein <kasi_at_arcor.de> wrote:
> 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