我正在尝试使用 curl 通过 twitter 实现登录解析,此链接中的指南: https ://parse.com/docs/rest.html#users-signup
curl -X POST \
-H "X-Parse-Application-Id: REMOVED" \
-H "X-Parse-REST-API-Key: REMOVED" \
-H "Content-Type: application/json" \
-d '{
"authData": {
"twitter": {
"id": "12345678",
"screen_name": "ParseIt",
"consumer_key": "REMOVED",
"consumer_secret": "REMOVED",
"auth_token": "REMOVED",
"auth_token_secret": "REMOVED"
}
}
}' \
https://api.parse.com/1/users
这是我在 PHP 中的实现代码:
$ci = curl_init();
$data = '{"authData":{"twitter":{"id":"REMOVED","screen_name":"cat",
"consumer_key":"REMOVED",
"consumer_secret":"REMOVED",
"auth_token":"REMOVED",
"auth_token_secret":"REMOVED"}}}';
$header = array("X-Parse-Application-Id: REMOVED",
"X-Parse-REST-API-Key: REMOVED",
"Content-Type: application/json"
);
curl_setopt ($ci, CURLOPT_HTTPHEADER, $header);
curl_setopt($ci,CURLOPT_POST,true);
curl_setopt($ci,CURLOPT_POSTFIELDS,$data);
curl_setopt($ci,CURLOPT_URL,'https://api.parse.com/1/users');
$response = curl_exec($ci);
var_dump($response);
curl_close($ci);
但是 var_dump($response) 的结果是假的。我不知道我的代码有什么问题。有谁能够帮助我?