Comment on page
JSON specification
The method of dispatch is always
POST
Query headers should always contain
Content-type: text/json; charset=utf-8;
JSON document encoding:
UTF-8
http://lk.mysmpp.ru
PHP
<?php
// 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);
curl_close($ch);
echo $result;
Last modified 3mo ago