Each request must be send via $_POST and must have the token parameter included. Click to see how to generate token
The ItTrust APi have two types of request:
1 - returning user ids.
2 - returning user details for specific ID
The returned format is XML
Each request return an XML that will contain :
1.Status - that contains
< ?php
header("Content-type: text/xml");
$url = 'http://api.ittrust.ro/getIDs.php';
$data['token']="bGllcGFyb2xh";//required -your encoded string
$data['limit']="10";//optional
$data['lastID']=4852;//optional
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, http_build_query($data));
$xmlstring = curl_exec($handle);//the xmlfile
//////////////////// xml to array
$xml = simplexml_load_string($xmlstring, "SimpleXMLElement", LIBXML_NOCDATA);
$json = json_encode($xml);
$array = json_decode($json,TRUE);
?>
< ?php
header("Content-type: text/xml");
$url = 'http://api.ittrust.ro/getUser.php';
$data['token']="bGllcGFyb2xh";//required -your encoded string
$data['userID']="10";//required
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, http_build_query($data));
$xmlstring = curl_exec($handle);//the xmlfile
//////////////////// xml to array
$xml = simplexml_load_string($xmlstring, "SimpleXMLElement", LIBXML_NOCDATA);
$json = json_encode($xml);
$array = json_decode($json,TRUE);
?>
< ?php
$username = "myusername";
$password = "myPassword";
//now we will generate the token
$myToken=base64_encode($username.":".$password);
?>
Now we have to include the generated token on each request we send.