ローカルサーバーにPHPでJSONデータを投稿しようとしています。以下のコードがありますが、機能していません。私は重要なことを逃しましたか?
$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);