Interface design documentation and code focus on two, one is authentication, one is the escalation data, that is, the post data to the API interface.
The authentication section requires you to get tokens (tokens) based on the URL address provided in the document, the username and password of the Access interface.
A more complex token design may require a digital signature technique, which can be referenced in the following links: Digital verification
The code will need to use the HttpClient class library.
Public Function Getoken () {
Include ("HttpClient.class.php");
Address of destination Host
$Client = new HttpClient ("IP");
Requested page address
$url = "Your url";
The parameters of the post
$params = Array (' account ' = ' accounts ', ' password ' = ' password ');
$content = $Client->quickpost ($url, $params);
if (! $content) {
Print_r (0);
}
Return Json_decode ($content, true);
}
Then submit the data:
Public Function Upload_data ($token, $params) {
Requested page address
$url = "Your url?token=". $token;
$ch = Curl_init ();
curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, Curlopt_post, 1);
curl_setopt ($ch, Curlopt_header, 0);
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_postfields, $params);
$result = curl_exec ($ch);
Curl_close ($ch);
Return Json_decode ($result, true);
}
The submission of the data is successful.
API Interface Code