0
使用Parse.com和REST API。我正在發送PUT請求以更新記錄。完成更新報告但未發生
$url = 'https://api.parse.com/1/classes/Language/lXn2Jr8g3D';
$headers = array(
"Content-Type: application/json",
"X-Parse-Application-Id: " . $appId,
"X-Parse-REST-API-Key: " . $apiKey ,
);
$objectData = '{"designation":"barfoo", "order":6}';
$rest = curl_init();
curl_setopt($rest,CURLOPT_URL,$url);
curl_setopt($rest,CURLOPT_PUT,1);
curl_setopt($rest,CURLOPT_POSTFIELDS,$objectData);
curl_setopt($rest,CURLOPT_HTTPHEADER,$headers);
curl_setopt($rest,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($rest,CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($rest);
echo $response;
curl_close($rest);
該報告回
{"updatedAt":"2015-02-09T22:28:57.676Z"}
我看到的記錄,我看不到我要求的變化。但更新的字段是真正的更新。事實上,這是唯一得到更新的東西! 如果我從url中刪除objectId並使用POST而不是PUT,插入工作得很好。
不用說,確切的捲曲shell命令就像一個魅力。 – denispyr 2015-02-09 22:57:56
與你的問題無關,但請不要這樣做'curl_setopt($ rest,CURLOPT_SSL_VERIFYPEER,false);':) – 2015-02-10 01:20:34