curl -i -X POST -d'json = {“Amount”:1000,“idPlayers”:1}'http://www.myurl.com/updateamount.php
我的PHP代码:
<?php
$json = urldecode($_GET['jsonSendData']);
$json = str_replace("\\", "", $json);
$data = json_decode($json, true);
// if i hard code it here it works fine, but need from a post from curl
//$json = '{"Amount":1000,"idPlayers":1}';
$data = json_decode($json, true);
echo "json = ", $json;
$amount = mysql_real_escape_string($data['Amount']);
$id = mysql_real_escape_string($data['idPlayers']);
echo "Amount = ",$amount;
return;
答案 0 :(得分:1)
尝试更改以阅读发布数据并使用正确的名称:
$json = urldecode($_POST['json']);