eBay
  • Daily Deals
  • Sell
  • Customer Support
  • Shop Deals
Reply
Community Member
Posts: 141
Registered: ‎06-20-2004

PHP and HTTPS post

Has anyone successfully done an HTTPS post with PHP? Does anyone use PHP for their file creation? Just curious..
Please use plain text.
Community Member
Posts: 10
Registered: ‎06-17-2004

PHP and HTTPS post

in reply to gogamerscom
Heh, that's actually the method i was going about - And no, so far i have had absolutely no success with cURL or any other method of post to the programmatic link they gave me. My guess would be that it isn't functional yet - because you and I are the only people trying to use it :smileyhappy: . - Shoot me an email at rayr@inetdirectsales.com i'd like to discuss my further File Exchange developments with a fellow coder. I've been waiting for you! :smileyhappy:
Please use plain text.
Community Member
Posts: 15
Registered: ‎06-29-2005

PHP and HTTPS post

in reply to gogamerscom
Finally! More people trying to do progammatic posts! We should all get together to figure this out. When I tried a while back, I would always get a "Not Responding" error. Until I hear from somebody that this feature actually works, I'm going to consider it to be a myth. Let me know if you folks find some way to do it that works (preferribly with cURL or wget). And eBay: Some response would be appreciated.

--
Sam Kennedy
Please use plain text.
Community Member
Posts: 141
Registered: ‎06-20-2004

PHP and HTTPS post

in reply to gogamerscom
If anyone feels like contacting me, I'm always on AIM with the screenname chefjoeardee

-Joe
Please use plain text.
Community Member
Posts: 2
Registered: ‎09-09-2005

PHP and HTTPS post

in reply to gogamerscom
We've spent a full 32 hours of development time on this. We gave up on PHP using cURL and fsockopen -- file exchange is running using a version of IIS that violates the SSL standard, and closes the connection early, in a way that interacts very poorly with a PHP bug. ( http://bugs.php.net/bug.php?id=23220 )

We've given up on PHP here, for the time being, and we're trying perl, but we're still having issues. We're getting way further now than we were with PHP, though.

At this point I'm just hoping to stumble across someone else's working code.

I'm on AIM as maleshomt
Please use plain text.
Community Member
Posts: 15
Registered: ‎06-29-2005

PHP and HTTPS post

in reply to gogamerscom
AIM: samrolken
Please use plain text.
Community Member
Posts: 141
Registered: ‎06-20-2004

PHP and HTTPS post

in reply to gogamerscom
Using cURL and PHP Ive managed to login to eBay, grab the cookies necessary, and perform an HTTP Post to the upload form (emulating a user). Unfortunately, nothing seems to upload, and all I get a response is:
< HTTP/1.1 100 Continue
< Server: Microsoft-IIS/5.0
< Date: Tue, 13 Sep 2005 16:16:01 GMT
< HTTP/1.1 200 OK
< Server: Microsoft-IIS/5.0
< Date: Tue, 13 Sep 2005 16:16:01 GMT
< Connection: close
< Server: WebSphere Application Server/4.0
< Content-Type: text/html;charset=iso-8859-1
(I've removed my cookies out of the response... just cause)

Anyone else have any ideas? Im tinkering with this as it seems to be best choice but maybe someone else has any ideas.

-Joe
Please use plain text.
Community Member
Posts: 141
Registered: ‎06-20-2004

PHP and HTTPS post

in reply to gogamerscom
Heh, I sware every time I post, complaining about something, I manage to solve my problem.

I can now do a direct post to eBay via PHP + cURL.

:smileyhappy:

-Joe
Please use plain text.
Community Member
Posts: 2
Registered: ‎09-09-2005

PHP and HTTPS post

in reply to gogamerscom
We've got a working version here as well, using perl and the LWP library - we emulate a user posting their file to the upload form, similar to what Joe mentioned a couple of posts up.

We GET the login form, read the cookies, pass them along with a POST of the login form, read cookies again, and then POST the upload form.

I'd share our code, but the boss won't let me. Best of luck!
Please use plain text.
Community Member
Posts: 31
Registered: ‎09-20-2005

PHP and HTTPS post

in reply to gogamerscom
How did you guys obtain the File Exchange Upload token? When I go to the following web page, it displays a blank token:

http://pages.ebay.com/file_exchange/gettoken.html

TIA,
NHFashions
Home of the deeply discounted fragrances
Please use plain text.
Community Member
Posts: 141
Registered: ‎06-20-2004

PHP and HTTPS post

in reply to gogamerscom
We circumvented the whole token thing.
Please use plain text.
Community Member
Posts: 5
Registered: ‎11-22-2005

PHP and HTTPS post

in reply to gogamerscom
I use VB.NET to do the same thing as emulating login and upload file. I now get "The browser you are using is rejecting cookies" error back. I sure used the cookiescontainer. Anyone have any idea?
Please use plain text.
Community Member
Posts: 5
Registered: ‎11-22-2005

PHP and HTTPS post

in reply to gogamerscom
I'm just like Joe. I spent 2 days on this problem. I finally got it to work. Yeh! Main thing is to maintain cookies.

Thank you,
sam
Please use plain text.
Community Member
Posts: 1
Registered: ‎12-03-2005

PHP and HTTPS post

in reply to gogamerscom
I use Php + cUrl with no luck, everything I send to send token with upload file, I get:

cURL error:failed creating formpost data

Anyone has same experience?
Please use plain text.
Community Member
Posts: 2
Registered: ‎12-09-2005

PHP and HTTPS post

in reply to gogamerscom
Hey you VB.NET guys that got this maybe you could help out with a little example?

Ebay gave me 3 URLs they said I had to hit in succession but I've tried that and it doesn't work.

https://signin.ebay.com/ws/eBayISAPI.dll?SignIn

https://signin.ebay.com/ws/eBayISAPI.dll?SignInWelcome&co_partnerId=2&userid=&pass=

http://bulksell.ebay.com/ws/eBayISAPI.dll?FileExchangeDownload&jobId=

This does not seem to work. I POST the data and maintain cookie session (at least I think I'm doing this right) but when I get to that second link (including my login) I get a Page Not Found error.

Any tips?
Please use plain text.
Community Member
Posts: 1
Registered: ‎07-16-2006

PHP and HTTPS post

in reply to gogamerscom
Anyone have working code for this????
Please use plain text.
Community Member
Posts: 3
Registered: ‎06-01-2010

PHP and HTTPS post

in reply to gogamerscom
YES!!!!!!!!!!!!!!!! Finally! I got it working with php and curl, and not using the token, just "loggin in" and the sumbitting the file. I actually had it working for an hour but thought I changed something because it wasn't working. I then realized though it doesn't work right if you use the same name file within 24 hours. So you'll need to have your program tack on random numbers to the listings.csv file so its like listings34232.csv etc etc. Anyways, you'll have to then pass that to the ebay.php file so it knows what the files called. But anyways put this in a file called ebay.php and it will work:


$ebay_user_id = "yourusername"; // ebay id
$ebay_user_password = "yourpassword"; // ebay password
$emailaddress = ""; //email address status about uploads will goto
$cookie_file_path = "cookie"; // cookie file (dont bother changing)

// 1 - Get the Cookies required to login from the welcome login page

$LOGINURL = "http://signin.ebay.com/aw-cgi/eBayISAPI.dll?SignIn";
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$LOGINURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$result = curl_exec ($ch);
curl_close ($ch);

// 2 - Post Login Cookies and Login Information to Page http://signin.ebay.com/aw-cgi/eBayISAPI.dll

$LOGINURL = "http://signin.ebay.com/aw-cgi/eBayISAPI.dll";
$POSTFIELDS = 'MfcISAPICommand=SignInWelcome&siteid=0&co_partnerId=2&UsingSSL=0&ru=&pp=&pa1=&pa2=&pa3=&i1=-1&pageType=-1&userid='. $ebay_user_id .'&pass='. $ebay_user_password;
$reffer = "http://signin.ebay.com/aw-cgi/eBayISAPI.dll?SignIn";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$LOGINURL);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, $reffer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);
$result = curl_exec ($ch);

// 3 - We submit the file to be posted and used in eBay File Exchange

curl_setopt($ch,CURLOPT_URL,'http://bulksell.ebay.com/ws/eBayISAPI.dll?FileExchangeUploadSuccess');
curl_setopt($ch, CURLOPT_POST, 1);
$postdata['emailAddress'] = $emailaddress;
$postdata['uploadFile'] = "@./listings.csv"; //The @ in front makes CURL load the file content, not just use the literal string
curl_setopt($ch,CURLOPT_POSTFIELDS,$postdata);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,0);
curl_setopt($ch, CURLOPT_HEADER , 1);
curl_setopt($ch, CURLOPT_USERAGENT, $defined_vars['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

$result = curl_exec($ch);
curl_close ($ch);

print $result;
Please use plain text.
Community Member
Posts: 3
Registered: ‎06-01-2010

PHP and HTTPS post

in reply to gogamerscom
and of course you'll need the < ? and ? > at the top and bottom without the space in between.
Please use plain text.
Community Member
Posts: 3
Registered: ‎03-12-2006

PHP and HTTPS post

in reply to gogamerscom
garyposnerinc- You are the man! Thanks for posting the code. I wish ebay would publish like that in their manual. They designed the thing afterall. Anyway, thanks for saving me countless hours of frustration.

Kenja
Please use plain text.
Community Member
Posts: 8
Registered: ‎05-25-2006

PHP and HTTPS post

in reply to gogamerscom
the following works fine for me:

$token = "...get your own token!...";
$ebay_url = "https://bulksell.ebay.com/ws/eBayISAPI.dll?FileExchangeUpload";

$sendheaders = array(
"User-Agent: ThunderIT.com eBay FE Client v0.1",
);
$fields = array(
"token" => $token,
"file" => "@listing.csv"
);

$ch = curl_init($ebay_url);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 1); // set to 0 to eliminate header info from response
curl_setopt($ch, CURLOPT_NOBODY, 0); // set to 1 to eliminate body info from response
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); // use HTTP/1.0 instead of 1.1
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response. ###
curl_setopt($ch, CURLOPT_HTTPHEADER, $sendheaders);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); // use HTTP POST to send form data

$resp = curl_exec($ch); //execute post and get results
curl_close ($ch);
Please use plain text.