如何在parse.com上获取appopen事件的用途

时间:2014-11-10 13:22:28

标签: php rest parse-platform

当调用appOpen事件时,我得到空白的json

我的代码: -

$headers = array( 
"X-Parse-Application-Id:trPYPHrI1Cfb8Q4w3TQ5HY7RoDcOFSM4okdNWDyC" , 
"X-Parse-REST-API-Key:OeNTANdx5A6ILHIZi3NfVcuE3GPDg4Cmyo9aQM1R",
"Content-Type: application/json"
);

$data='{ }';


$rest = curl_init();
curl_setopt($rest,CURLOPT_URL,"https://api.parse.com/1/events/AppOpened");
curl_setopt($rest,CURLOPT_HTTPHEADER,$headers);
curl_setopt($rest, CURLOPT_POST,true);
curl_setopt($rest, CURLOPT_RETURNTRANSFER, true);
curl_setopt($rest, CURLOPT_POSTFIELDS, $data);

$response = curl_exec($rest);
echo $response;
curl_close($rest);

输出:{}

工作网址:http://norefresh.thesparxitsolutions.com/rajeevranjan/parse/appopen.php

请帮忙。

1 个答案:

答案 0 :(得分:0)

此网址https://api.parse.com/1/events/AppOpened

return {}或true表示您的应用已推出。您可以通过

查看响应代码
$responseCode = curl_getinfo($rest, CURLINFO_HTTP_CODE);
echo "<pre>";
print_r($responseCode);
echo "</pre>";

我已与其他网址https://api.parse.com/1/classes/Player核对过,因为它工作正常。检查以下代码:

$headers = array( 
"X-Parse-Application-Id:trPYPHrI1Cfb8Q4w3TQ5HY7RoDcOFSM4okdNWDyC" , 
"X-Parse-REST-API-Key:OeNTANdx5A6ILHIZi3NfVcuE3GPDg4Cmyo9aQM1R",
"Content-Type: application/json"
);

$data='{ }';


$rest = curl_init();
curl_setopt($rest,CURLOPT_URL,"https://api.parse.com/1/classes/Player");
curl_setopt($rest,CURLOPT_HTTPHEADER,$headers);
curl_setopt($rest, CURLOPT_POST,true);
curl_setopt($rest, CURLOPT_RETURNTRANSFER, true);
curl_setopt($rest, CURLOPT_POSTFIELDS, $data);

$response = curl_exec($rest);
echo "<pre>";
print_r($response);
echo "</pre>";
curl_close($rest);