24. März 2015 15:47
<?php
// récupération token
$user = "login";
$pass = "mot de passe";
$authentication = base64_encode($user.":".$pass);
$httpheader = array('Authorization: Basic '.$authentication);
$itemsFeedURL = "https://sts.preprod-cdiscount.com/users/httpIssue.svc/?realm=https://wsvc.preprod-cdiscount.com/MarketplaceAPIService.svc";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $itemsFeedURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
$response = curl_exec($ch);
curl_close($ch);
$xmlResponse = simplexml_load_string(trim($response));
echo $xmlResponse;
?>
C_path :='https://sts.preprod-cdiscount.com/users/httpIssue.svc/'
+ '?realm=https://wsvc.preprod-cdiscount.com/MarketplaceAPIService.svc';
auto := 'base64_encode="***:***';
dlg.OPEN('Hole Cdiscount Token...');
CREATE(xmlHttp);
xmlHttp.open('GET',C_path, FALSE);
xmlHttp.setRequestHeader('authorization: Basic', auto);
xmlHttp.send();
xmlDoc.load(xmlHttp.responseBody);
xmlDoc.save('C:\TEMP\CDToken.xml');
dlg.CLOSE;