I'm trying to post some JSON data in PHP on my local server. I have the following code below but it's not working. Did i miss a vital thing?
$url = 'http://localhost/mmcv/chart1.php';
//open connection
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADERS,array('Content-Type: application/json'));
$result = curl_exec($ch);