PHP put request with JSON

314 views Asked by At

I am using ParseAPI (https://parse.com/docs/rest/guide#objects-updating-objects) and I'm attempting to update an object with their rest api. I get a response back from parse saying the object was updated, however no change was made.

Can someone please guide me in the correct direction?

Thank you!!

<?php
$url = ' https://api.parse.com/1/classes/GameScore/Ed1nuqPvcm';    
$appId = 'my app id';  
$restKey = 'my rest key';
$headers = array(  
"Content-Type: application/json",
"X-Parse-REST-API-Key: " . $restKey,
"X-Parse-Application-Id: " . $appId
);

 $data = array('pass' => 'hi');
 $jsonDataEncoded = json_encode($data);

  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
 curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);
 curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($jsonDataEncoded));

 $response = curl_exec($ch);
 echo $response;
 ?>
0

There are 0 answers