![]() |
|
![]() |
|
cURL ![]() ![]() ![]() curlpp mailing list Archives
[cURLpp] Curl and eBay-Login
From: Karsten Stein <kasi_at_arcor.de>
Date: Sat, 6 Aug 2005 10:48:45 +0200
Hi,
I've writen the eBay-Login-Script in C++ (original:
// 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
char cookie_file_path[] = "f:\\test.txt"; // Please set your Cookie
char LOGINURL[] =
char agent[] = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;
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[] =
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
.ebay.com TRUE / FALSE 1154735978 nonsession
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,
Set-Cookie:
r2qjaqq1vVw2LpZPwWdNFIAhyw**;Domain=.ebay.com;Expires=Sat, 05-Aug-2006
Cache-Control: private
Pragma: no-cache
location:
UsingSSL=&ru=&pp=&pa2=&errmsg=&runame=&ruparams=&ruproduct=&sid=&favoritenav
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:
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,
_______________________________________________
These mail archives are generated by hypermail. |
Page updated November 12, 2010.
web site info