question

junseihin avatar image
0 Likes"
junseihin asked ·

GeteBayTime alway return failure (php)

Hello, I'm just start to lern ebay api and I try to test simple api on php, This api work fine on api test tool. my code here (most of parameters copy from api test tool) '; $connection = curl_init(); curl_setopt($connection, CURLOPT_URL, $url); curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($connection, CURLOPT_HTTPHEADER, $headers); curl_setopt($connection, CURLOPT_POST, 1); curl_setopt($connection, CURLOPT_POSTFIELDS, $requestXML); curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($connection); curl_close($connection); echo $response; ?> and result: Failure Input data is invalid. Input data for the given tag is invalid or missing. Please check API documentation. 1.22 Error XML document structures must start and end within the same entity. RequestError E897_CORE_APILW_17346475_R1 897 I've tested api GetSingleItem as well but get the same result. It seem some problem about requestXML I have no idea what wrong. Thank you for any correction/suggestion.
api-problemPHPxml-php-curl
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

junseihin avatar image
0 Likes"
junseihin answered ·
Thank you very much. Its work like a charm :D
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

clickimusprime avatar image
0 Likes"
clickimusprime answered ·
Adding a header: "Content-Type: text/xml" should fix it But do yourself a favor and use the GET syntax instead. You can just build your URLs with string functions and no headers or $requestXML are needed. $url = " http://open.api.ebay.com/shopping?callname=GeteBayTime&version=889&siteid=0≈pid=APPID&responseencoding=XML";; $resp = file_get_contents($url); // OR $resp = GetCurl($url); function GetCurl($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 15); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_ENCODING , "gzip"); $result = curl_exec($ch); curl_close($ch); return $result; }
· Share
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.