Comment on page

JSON specification

The formats of requests and responses to the API comply with the specification JSON API v1.0.
The method of dispatch is always POST
Query headers should always contain
Content-type: text/json; charset=utf-8;
JSON document encoding: UTF-8

Server address for sending requests

Examples of JSON transfer

// JSON-document
$src = json_encode([
"login" => "login",
"password" => "password"
  // server address
$href = 'http://server/script.php';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/json; charset=utf-8'));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CRLF, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $src);
    curl_setopt($ch, CURLOPT_URL, $href);
    $result = curl_exec($ch);
    echo $result;
Last modified 3mo ago