Hi,
I am working with a freelance developer to migrate from File Exchange to Feed API.
The developer has created a solution (below) that works on a local server, but not on a live server. Both he and I have spent hours trying to debug the code but to no avail. He has posted the message below on StackOverflow.
Can anyone provide a point in the general direction to what the issue may be?
Many thanks,
Mark
--------------------------------------------------------------------------------------------------------------
Here is my script which uploads feed to ebay. The script working on local PC but when I upload to my live server, it does not work.
Here is my code.
public function createTask($feedType='FX_LISTING') { $link = "https://api.ebay.com/sell/feed/v1/task"; //$appConfig = parse_ini_file("config.ini"); //payload $payload = json_encode(array("schemaVersion"=>"1.0","feedType"=>"FX_LISTING")); //$appConfig['user_token'] = 'mehboob'; $ch = curl_init($link); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Authorization:Bearer ' . $this->userToken, 'Accept:application/json', 'Content-Type:application/json', 'X-EBAY-C-MARKETPLACE-ID: EBAY_US' )); curl_setopt($ch, CURLHEADER_SEPARATE, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 1); //scurl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:8888'); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); $response = curl_exec($ch); $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); $headers = substr($response, 0, $header_size); $body = substr($response, $header_size); $info = curl_getinfo($ch); echo($body); curl_close($ch); $headers = explode("\r\n", $headers); // The seperator used in the Response Header is CRLF (Aka. \r\n) $headers = array_filter($headers); $loc = basename(implode(preg_grep("/^location.*/", $headers))); return $loc; } public function uploadFile($taskID, $fName) { $link = "https://api.ebay.com/sell/feed/v1/task/$taskID/upload_file"; $curl = curl_init(); curl_setopt($curl, CURLINFO_HEADER_OUT, true); // curl_setopt($curl, CURLOPT_PROXY, '127.0.0.1:8888'); curl_setopt_array($curl, array( CURLOPT_URL => $link, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_SSL_VERIFYHOST=> 1, CURLOPT_SSL_VERIFYPEER=> 1, CURLOPT_TIMEOUT => 0, CURLOPT_HEADER => 1, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => array('file'=> new CURLFILE(realpath($fName)),'type' => 'form-data'), CURLOPT_HTTPHEADER => array( 'Authorization: Bearer ' . $this->userToken, 'Content-Type: multipart/form-data', 'X-EBAY-C-MARKETPLACE-ID: EBAY_US' ), )); $response = curl_exec($curl); var_dump($response); curl_close($curl); }
Using the code as under:
$feedPath = __DIR__ . "/" ."feed.csv";
$taskID= createTask();
$uF = uploadFile($taskID,$feedPath);
The above code works fine on my local PC, creating task id and uploading file to ebay. But when I am uploading code on my server, it gets failed. I confirmed the path to the file on my server is OK. Also I am using the same version of PHP on my server.
Please see the following response I receives from Server.
string(595) "HTTP/1.1 100 Continue HTTP/1.1 500 Internal Server Error rlogid: t6pitaf%60btuf1%3D9vjdpitaf%60btuf1*or3ah%28rbpv6775-1795f5551e5-0x2340 x-ebay-client-tls-version: TLSv1.2 content-type: application/json content-length: 228 date: Wed, 12 May 2021 06:48:18 GMT x-envoy-upstream-service-time: 125 server: ebay-proxy-server x-ebay-pop-id: UFES2-LVSAZ01-api {"errors":[{"errorId":160001,"domain":"API_FEED","subdomain":"Selling","category":"APPLICATION","message":"There was a problem with an eBay internal system or process. Contact eBay Developer Technical Support for assistance."}]}"
The error says about "eBay internal error" but I don't think so. its due to some problem in the code.
The documentation to the above eBay service is as under: eBay Feed File - uploadFile documentation
Your cooperation in this context will be highly appreciated.