易趣沙盒API |宾客地点订单|错误:来自服务器的空回复

时间:2017-05-23 08:30:10

标签: ebay-api

我正在使用eBay Sandbox API下订单,我已生成会话ID并传递给此网址https://api.sandbox.ebay.com/buy/order/v1/guest_checkout_session/ {session_id} / place_order

我的php curl是

                  $header = array('Accept: application/json',
                        'Authorization: Bearer '.$authToken,
                        'Content-Type: application/json',
                        'X-EBAY-C-ENDUSERCTX:affiliateCampaignId=<ePNCampaignId>,affiliateReferenceId=<referenceId>'
                     ); 
        $placeOrderUrl = "https://api.sandbox.ebay.com/buy/order/v1/guest_checkout_session/{checkoutSessionId}/place_order";


   $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, trim($placeOrderUrl));
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
        curl_setopt($ch, CURLOPT_POST, 1); 
        curl_setopt($ch, CURLINFO_HEADER_OUT, true);
 $response = curl_exec($ch);
        $information = curl_getinfo($ch);
        print_r($information);
        echo '<br/>';

        echo 'Error Code '.curl_errno($ch).'<br/>';
        if(curl_errno($ch)){
            echo "ERROR:".curl_error($ch);
        }
        curl_close($ch);
        echo '<br/>';
        print_r(json_decode($response,true));

但我收到了错误

错误代码52 错误:从服务器清空回复

这是输出数组

       Array(
[url] => https://api.sandbox.ebay.com/buy/order/v1/guest_checkout_session/v1|5000704767|133511112/place_order
[content_type] => 
[http_code] => 100
[header_size] => 25
[request_size] => 2146
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.314586
[namelookup_time] => 2.3E-5
[connect_time] => 0.073967
[pretransfer_time] => 0.236347
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => -1
[upload_content_length] => -1
[starttransfer_time] => 0.314579
[redirect_time] => 0
[redirect_url] => 
[primary_ip] => 66.135.212.84
[certinfo] => Array  ()
 [primary_port] => 443
[local_ip] => 198.71.236.80
[local_port] => 37903
[request_header] => POST /buy/order/v1/guest_checkout_session/v1|5000704767|133511112/place_order HTTP/1.Host: api.sandbox.ebay.comAccept: application/json
Authorization: Bearer {token} 
Content-Type: application/json
X-EBAY-C-ENDUSERCTX:affiliateCampaignId=,affiliateReferenceId=
Expect: 100-continue)

1 个答案:

答案 0 :(得分:0)

您必须对sessionId进行urlencode:v1|5000704767|133511112应为v1%7C5000704767%7C133511112