Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: Sockets help

  1. #11
    Join Date
    Sep 2010
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    So instead of:
    PHP Code:
    fputs($conn,  "POST /ws/eBayISAPI.dll?FileExchangeProgrammaticDownload HTTP/1.1\r\n");
    fputs($conn"Connection: Keep-Alive\r\n");
    fputs($conn"User-Agent: My Client App v1.0\r\n");
    . . . . . 
    I should use:
    PHP Code:
    fputs($conn$var_with_all_lines_including_file_to_send); 
    ?
    I've noticed that when the script "should" work, it just runs for a really long time and never actually does anything. I guess this would be the problem?

  2. #12
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by jmace View Post
    So instead of:
    PHP Code:
    fputs($conn,  "POST /ws/eBayISAPI.dll?FileExchangeProgrammaticDownload HTTP/1.1\r\n");
    fputs($conn"Connection: Keep-Alive\r\n");
    fputs($conn"User-Agent: My Client App v1.0\r\n");
    . . . . . 
    I should use:
    PHP Code:
    fputs($conn$var_with_all_lines_including_file_to_send); 
    ?
    yes.
    Quote Originally Posted by jmace View Post
    I've noticed that when the script "should" work, it just runs for a really long time and never actually does anything. I guess this would be the problem?
    actually, I've run into that before. It may be an issue with your host (many have firewalls that will get in the way of this sort of connection; even though they may advertise that it's allowed. try asking them nicely).

  3. #13
    Join Date
    Sep 2010
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    ARGH!!! I am so close and yet so far away!

    Here is my code now:
    PHP Code:
    <?php

    set_time_limit
    (0);

    // GET THE FEED FILE
    $options = array(
        
    CURLOPT_RETURNTRANSFER => true,     // return web page
        
    CURLOPT_HEADER         => false,    // don't return headers
        
    CURLOPT_FOLLOWLOCATION => true,     // follow redirects
        
    CURLOPT_ENCODING       => "",       // handle all encodings
        
    CURLOPT_USERAGENT      => "fun-shop"// who am i
        
    CURLOPT_AUTOREFERER    => true,     // set referer on redirect
        
    CURLOPT_CONNECTTIMEOUT => 120,      // timeout on connect
        
    CURLOPT_TIMEOUT        => 120,      // timeout on response
        
    CURLOPT_MAXREDIRS      => 10,       // stop after 10 redirects
        
    CURLOPT_SSL_VERIFYPEER => false,
    );

    $ch curl_init('https://www.mysite.com/pull_feed.php');
    curl_setopt_array$ch$options );
    $contents curl_exec$ch );
    curl_close$ch );


    //----------------------------------------------------//

    //OPEN THE CONNECTION
    $conn fsockopen('ssl://bulksell.ebay.com'443);

    $request "POST /ws/eBayISAPI.dll?FileExchangeUpload HTTP/1.1\r\n";
    $request .= "Connection: Keep-Alive\r\n";
    $request .= "User-Agent: My Client App v1.0\r\n";
    $request .= "Host: bulksell.ebay.com\r\n";
    $request .= "https://bulksell.ebay.com/ws/eBayISAPI.dll?FileExchangeUpload\r\n";
    $request .= "Content-type: multipart/form-data;\r\n";
    $request .= "boundary=THIS_STRING_SEPARATES\r\n";
    $request .= "Content-Length: ".strlen($contents)."\r\n\r\n";
    $request .= "--THIS_STRING_SEPARATES\r\n";
    $request .= "Content-Disposition: form-data;\r\n name=\"token\" \r\n";
    $request .= "SECRET TOKEN HERE\r\n";
    $request .= "Content-Disposition: form-data; name=\"file\";\r\n";
    $request .= "filename=\"listings.csv\"\r\n";
    $request .= "Content-Type: text/csv\r\n\r\n";
    $request .= $contents;
    $request .= "--THIS_STRING_SEPARATES\r\n";

    // SEND THE REQUEST
    fputs($conn$request);

    // GET THE RESULT
    while(!feof($conn)) {
        echo 
    fgets($conn128);
    }

    // CLOSE CONNECTION
    fclose($conn);

    ?>
    The result is this:
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Set-Cookie: dp1=bu1p/QEBfX0BAX19AQA**4ed554d7^; Domain=.ebay.com; Expires=Wed, 28-Nov-2012 21:55:35 GMT; Path=/
    Set-Cookie: s=CgAD4ACBM9XLXOTlhMjNmMTgxMmMwYTIzMzk0YjI4OTQyZmZmZmQ2YTGNgGPD; Domain=.ebay.com; Path=/
    Set-Cookie: nonsession=CgADKACBWWiLXOTlhMjNmMTgxMmMwYTIzMzk0YjI4OTQyZmZmZmQ2YTEAywABTPQoXzH9XCbM; Domain=.ebay.com; Expires=Tue, 29-Nov-2011 21:55:35 GMT; Path=/
    Cache-Control: private
    Pragma: no-cache
    Content-Type: text/html;charset=UTF-8
    Content-Length: 755
    Date: Mon, 29 Nov 2010 21:55:35 GMT

    <html>
    <head>
    <!--eBay V3- msxml 6.0 XXXXXXXXXXXXXXXXXXXXXXXXXX-->
    <!--srcId - File Exchange Programmatically Upload-->
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
    <title>Upload File Programmatically</title><script language="JavaScript"><!--
    var pageName = "File Exchange Upload";

    //--></script><script language="javascript" src="http://include.ebaystatic.com/js/e695/us/legacy/globals_e6951us.js"> </script><script src="http://include.ebaystatic.com/js/e695/us/legacy/common_functions_e6951us.js"> </script></head>
    <body>
    An unknown problem interrupted the file transfer. Please try again.<br><a href="javascript:void(0);" onclick="self.close();return false;">Close</a></body>
    </html>
    Any more ideas?

    I tried contacting ebay support, and they were no help. They just bounced me around for an hour and then told me they don't offer support for these issues. . . .

  4. #14
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    how big is $contents ? maybe it's just taking a long time and something interrupted the connection. Your response doesn't seem to indicate anything else. How many times have you tried (this version) (and did you always get the same response)?

    Also, should there be a line feed after $contents (before --THIS_STRING_SEPARATES)?

  5. #15
    Join Date
    Sep 2010
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thank you for continuing to help me, traq. You've been a great help so far.

    The $contents variable isn't that big. In my last test, it was 2490 characters. Files that other people are sending the same way are easily 50 times that size.

    Here is the whole request that is being sent. I have played around with it, trying to add new lines in different places and such, but so far no luck. I doesn't matter how many times I try, I get the same error.

    POST /ws/eBayISAPI.dll?FileExchangeUpload HTTP/1.1
    Connection: Keep-Alive
    User-Agent: My Client App v1.0
    Host: bulksell.ebay.com
    https://bulksell.ebay.com/ws/eBayISA...ExchangeUpload
    Content-type: multipart/form-data;
    boundary=THIS_STRING_SEPARATES
    Content-Length: 2490
    --THIS_STRING_SEPARATES
    Content-Disposition: form-data; name="token"
    MY_TOKEN_GOES_HERE
    --THIS_STRING_SEPARATES
    Content-Disposition: form-data; name="file";
    filename="listings.csv"
    Content-Type: text/csv
    *Action(SiteID=US|Country=US|Currency=USD|Version=403|CC=UTF-8),"*Category","*Title","Subtitle","*Description","*ConditionID","PicURL","*Quantity","*Format","*StartPrice","BuyItNowPrice","*Duration","ImmediatePayRequired" ,"*Location","GalleryType","PayPalAccepted","PayPalEmailAddress","PaymentInstructions","StoreCategory","ShippingDiscountProfileID","ShippingService-1:Option","ShippingService-1:Cost","ShippingService-1:Priority","ShippingService-1:ShippingSurcharge","ShippingService-2:Option","ShippingService-2:Cost","ShippingService-2:Priority","ShippingService-2:ShippingSurcharge","*DispatchTimeMax","CustomLabel","*ReturnsAcceptedOption","RefundOption","ReturnsWithinOption","ShippingCostPaidBy","AdditionalDetails","Sh ippingType","PackageType","PackageDepth","PackageLength","PackageWidth","WeightMajor","WeightMinor","WeightUnit","ShippingCarrierUsed","ShipFromZipCode"
    "Add","52762","Noel Mouse Costume Mascot Medium","","This Noel Mouse w/Santa Coat & Hat Christmas Costume Mascot is merry as Santa\'s entourage and helper at your next Christmas corporate parade, Christmas play or Christmas theme park display. Our Noel Mouse w/Santa Coat & Hat Christmas Costume Mascot is created with a sewn and sculptured suit, matching head, two mittens and two shoe covers. ","1000","http://www.mysite.com/show_image.php?im=/img/01/01822a.jpg&nowater=1&size=500x500","1","FixedPrice","1195.00","","GTC","","77586","","1","ebay@mysite.com","","","","UPSGround","","","","","","","","1","01/01822AMD","ReturnsNotAccepted","","","","","Calculated","LargePackage","20","14","6","30","0","lb","UPSGround","77586"

    --THIS_STRING_SEPARATES

  6. #16
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    I'm afraid I don't know, then...

    Have you talked to your host (your host, not ebay) about socket connections (if they're allowed/ need any special configurations)? That's the only thing I can think of, at this point.

  7. The Following User Says Thank You to traq For This Useful Post:

    jmace (11-30-2010)

  8. #17
    Join Date
    Sep 2010
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thank you again for all of your help. I guess I'm either not going to be able to do this or I'll have to pray someone on ebay decides to help me. (The latter doesn't seem likely, given their lack of help so far. :-p)

  9. #18
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    I'm sorry to ask again, but I think you may have misunderstood what I'm asking.

    I'm not suggesting you ask ebay for help; I'm suggesting you ask your web host if there is anything (settings, firewalls, etc.) that may be interfering with the connections. If you've already done so, sorry - I missed it. But if you haven't, you should. Your host, and how they've configured your server, is a big piece of this puzzle.


  10. #19
    Join Date
    Sep 2010
    Posts
    18
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    No, your last post wasn't ambiguous-- I understood it. I've already talked to my web host and nothing should be keeping this code from working. Besides, I have a similar script that is sending feeds to Amazon, and it works perfectly fine in that context.

    My comment was that I don't know of anything else that I can do for this script. Apparently it just isn't going to work.

  11. #20
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    ok, then. good luck, I hope you can figure it out!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •