cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curlpp mailing list Archives

[cURLpp] Curl and eBay-Login

From: Karsten Stein <kasi_at_arcor.de>
Date: Sat, 6 Aug 2005 10:11:54 +0200

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.
I've also read this message:
http://curl.haxx.se/libcurl/php/examples/?ex=ebay_login.php, but the error
remains. Maybe you 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=XXXXX
X&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_HEADER,1);

       curl_easy_setopt(curl_handle, CURLOPT_NOBODY,1);

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=&pa
1=&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_HEADER,1);

       curl_easy_setopt(curl_handle, CURLOPT_NOBODY,1);

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
BAQAAAQVQcELtAAaAAPIAAULzDnAxAMsAAkLysvIxMADKACBMWK1qODNlMWZjMzcxMDUwYTBiNDY
xNjQwZTQwZmZmZDYyZTCiSqvqqdlKfLTebrZVuxBGmO+9tA**

 

And here are the 2 HTTP-Headers:

 

HTTP/1.1 302 Found

Server: Microsoft-IIS/5.0

Date: Fri, 05 Aug 2005 21:54:18 GMT

Connection: close

Server: WebSphere Application Server/4.0

Content-Type: text/html

Set-Cookie: ebay=%5Ecv%3D15555%5E;Domain=.ebay.com;Path=/

Set-Cookie: dp1=bu1p/QEBfX0BAX19AQA**44d5138b^;Domain=.ebay.com;Expires=Sun,
05-Aug-2007 21:54:19 GMT;Path=/

Set-Cookie:
nonsession=BAQAAAQWD79rsAAaAAPIAAUL0X/AxAMsAAkLz5xMxMADKACBMWeGLODNlMWZjMzcx
MDUwYTBiNDYxNjQwZTQwZmZmZDYyZTCE

r2qjaqq1vVw2LpZPwWdNFIAhyw**;Domain=.ebay.com;Expires=Sat, 05-Aug-2006
21:54:19 GMT;Path=/

Cache-Control: private

Pragma: no-cache

location:
https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&co_partnerId=2&pUserId=&site
id=0&pageType=&pa1=&i1=&bshowgif=&

UsingSSL=&ru=&pp=&pa2=&errmsg=&runame=&ruparams=&ruproduct=&sid=&favoritenav
=&migrateVisitor=

Content-Language: en

Content-Length: 0

 

HTTP/1.1 302 Found

Server: Microsoft-IIS/5.0

Date: Fri, 05 Aug 2005 21:54:24 GMT

Connection: close

Server: WebSphere Application Server/4.0

Content-Type: text/html

location:
http://pages.ebay.com/messages/page_not_responding.html?eBayErrorEventName=p
4plaijkehq%60%3C%3Dpo%2Bq0vo%60mlh

721-2005.08.05.14.54.19.753.PDT

Content-Language: en

Content-Length: 0

 

 

It's a great help If somebody can help me :-)

 

Best regards,
Karsten Stein

 

_______________________________________________
cURLpp mailing list
cURLpp_at_rrette.com
http://www.rrette.com/mailman/listinfo/curlpp
Received on 2005-08-09

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET