-1
から送信するJSON値を取得しませんカール-i -X POST -d 'のJSON = { "金額":1000、 "idPlayersを":1}' http://www.myurl.com/updateamount.phpPHPは、私はカール
私の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;
おかげで働いています!私は以前は投稿したが、正しくはしなかった! –
私のXcodeの人は私が以下のようにすることができると思うので、私たちは 'json'という値を送る必要はありません。どちらのアイデアでも動作しませんか? $ json = urldecode($ _ POST ['json']); \t $ json = str_replace( "\\"、 ""、$ json); \t $ data = json_decode($ json、true); // $ amount = json_decode($ _ POST ['Amount']); // $ player_id = json_decode($ _ POST ['idPlayers']); –