POST
JSON の形式でデータを受信しようとしています。次のようにカールしています。
curl -v --header 'content-type:application/json' -X POST --data '{"content":"test content","friends":[\"38383\",\"38282\",\"38389\"],"newFriends":0,"expires":"5-20-2013","region":"35-28"}' http://testserver.com/wg/create.php?action=post
PHP 側のコードは次のとおりです。
$data = json_decode(file_get_contents('php://input'));
$content = $data->{'content'};
$friends = $data->{'friends'}; // JSON array of FB IDs
$newFriends = $data->{'newFriends'};
$expires = $data->{'expires'};
$region = $data->{'region'};
しかし、私はprint_r ( $data)
何も返されません。POST
これは、フォームなしでAを処理する正しい方法ですか?