backendless不休息api没有返回正确的响应(代码:2002)

时间:2016-05-31 10:15:52

标签: php rest backendless

这就是我要做的事情

header('Content-Type: application/json');
$APP_ID= "application-id : xxxxxxxxxxxxxxxx";
$REST_KEY= "secret-key : xxxxxxxxxxxxxxx";
$APP_TYPE= "Content-Type:REST";
$POST = "POST";
$GET ="GET";
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $GET);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($curl, CURLOPT_HEADER, FALSE);
curl_setopt($curl, CURLOPT_HTTPHEADER, array($APP_ID, $REST_KEY, $APP_TYPE));
curl_setopt($curl, CURLOPT_URL, "http://api.backendless.com/test/data/items";);
$result = curl_exec( $curl );
curl_close( $curl );
$result = json_decode($result);
echo json_encode($result,JSON_PRETTY_PRINT);

作为回应我得到了这个

{
"code": 2002,
"message": "Version is disabled or provided wrong application info (application id or secret key)"
}

所有键和ID都正确,版本也正常工作

那么问题是什么?为什么它不能正确地吐出JSON结果?

更新版本 只需删除空格,如下所示

$APP_ID= "application-id: xxxxxxxxxxxxxxxx";
$REST_KEY= "secret-key: xxxxxxxxxxxxxxx";

0 个答案:

没有答案