如何使用curl-rest和php登录parse?

如何使用curl-rest和php登录parse?,php,rest,curl,parse-platform,Php,Rest,Curl,Parse Platform,我试图做一个简单的登录表单解析,但我找不到什么是问题。。。 这是我在这个代码之后得到的结果 移除echo$array并查看print\r输出的内容。尝试echo curl\u错误($handle)在curl\u exec($handle)之后该网站没有对您拥有的参数提供足够的响应provided@DevZer0:我相信您需要发送额外的标题。@DaveChen我看到您的正确答案了 $username = $_POST['username']; $password = $_POST['pa

我试图做一个简单的登录表单解析,但我找不到什么是问题。。。 这是我在这个代码之后得到的结果


移除
echo$array
并查看
print\r
输出的内容。尝试
echo curl\u错误($handle)
curl\u exec($handle)之后该网站没有对您拥有的参数提供足够的响应provided@DevZer0:我相信您需要发送额外的标题。@DaveChen我看到您的正确答案了
    $username = $_POST['username'];
$password = $_POST['password'];

$url = 'https://api.parse.com/1/login.php?username='.$username.'&password='.$password;

$headers = array(
 "Content-Type: application/json" ,
 "X-Parse-Application-Id: {app_id_hidden}" ,
 "X-Parse-REST-API-Key: {key_id_hidden}"
);

$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $url);    
curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);

$data = curl_exec($handle);
curl_close($handle);

$array = json_decode($data);
echo $array;
print_r($array);
$url ='https://api.parse.com/1/login';
$appId = '';  
$restKey = '';  

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

$username = "test";
$password = "test";

$rest = curl_init();  
curl_setopt($rest,CURLOPT_URL,$url);  
curl_setopt($rest,CURLOPT_HTTPGET,1);
curl_setopt($rest,CURLOPT_CUSTOMREQUEST,"GET");  
curl_setopt($rest, CURLOPT_ENCODING, 'username=test&password=test');
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);