Vous pouvez essayer leur API JSON à la place. J'ai essayé d'obtenir un exemple fonctionnel, mais je n'ai pas de nom d'application et je ne peux donc pas vérifier le résultat. Voici le code :
<?php
$appName = "Your App Name Here";
$post_data = array(
'jsonns.xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'jsonns.xs' => 'http://www.w3.org/2001/XMLSchema',
'jsonns.tns' => 'http://www.ebay.com/marketplace/search/v1/services',
'tns.findItemsByKeywordsRequest' => array(
'keywords' => 'harry potter pheonix'
)
);
$headers = array(
"X-EBAY-SOA-REQUEST-DATA-FORMAT: JSON",
"X-EBAY-SOA-RESPONSE-DATA-FORMAT: JSON",
"X-EBAY-SOA-OPERATION-NAME: findItemsByKeywords",
"X-EBAY-SOA-SECURITY-APPNAME: $appName"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://svcs.ebay.com/services/search/FindingService/v1');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post_data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
if($result) {
$response = json_decode($result);
}
curl_close($ch);
?>
Vous devez remplir $appName
avec le nom de l'application. De même, le X-EBAY-SOA-OPERATION-NAME
devra correspondre à l'appel réel, et le JSON devra être modifié si l'appel est différent.