Support Forum [ All Topics | New Topic ]

Thread: PHP sample code Not Working

<?php
$login = 'xxxx';
$password = 'xxxx';
$url = 'https://technet.rapaport.com:449/HTTP/JSON/Prices/GetPrice.aspx';
$data_string = urlencode('{
"request": {
"header": {
"username": "xxxx",
"password": "xxxx"
},
"body": {
"shape": "round"
}
}
}');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_USERPWD, "$login:$password");
//curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch);
curl_close($ch);
echo($result);
?>

pls check this code is correct


>> add a comment
Dev
05/07/2019 10:38


0 Replies: