I can send a json request with this code. But How can I read json request in with php http://www.test.com/post . it is my doman
function try($method_name, $json_data)
{
$ch = curl_init('http://www.test.com/post');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($json_data)));
$result = curl_exec($ch);
curl_close($ch);
//echo "<pre>$result</pre>";
$diziyap = json_decode($result);
if ($diziyap->Success==1) {
$sonuc = [1,''];
} else {
$sonuc = [0,json_decode(json_encode($diziyap->Errors), true)];
}
return $sonuc;
}
$sonuc = try('try', $json_data);
echo "<pre>";
echo $sonuc[0];