var body = 'name=' + encodeURIComponent('111') +
'&surname=' + encodeURIComponent('111');
var xhr=new XMLHttpRequest();
xhr.onreadystatechange=function(){
if (this.readyState==4&&this.status==200){
document.body.innerHTML=string;
}
};
xhr.open('POST',items.url,true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
xhr.send(body);
function post($url, $data) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
$data = [
"json_string" = '{"key":"value"}';
];
post("my-second.domen/api.php", $data);
$_POST["json_string"]
.