<?php
$url = '';
$username = '';
$password = '';
$xml_data = '
<xmlrequest>
<username>' . $username . '</username>
<usertoken>' . $password . '</usertoken>
<requesttype>authentication</requesttype>
<requestmethod>login</requestmethod>
<details>
</details>
</xmlrequest>
';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_POST, true);
if (!ini_get('safe_mode') && ini_get('open_basedir') == '') {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
}
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'xml=' . $xml_data);
$result = curl_exec($ch);
if($result === false) {
echo "Error performing request";
}
else {
$xml_doc = simplexml_load_string($result);
echo 'Status is ', $xml_doc->status, '<br/>';
if ($xml_doc->status == 'SUCCESS') {
echo 'Data is <br/>';
echo $xml_doc;
} else {
echo 'Error is ', $xml_doc->errormessage, '<br/>';
}
}
?>
Opmerkingen
0 opmerkingen
U moet u aanmelden om een opmerking te plaatsen.