Retrieving Data related to a top-level object from parse.com using PHP
- by Albeert Tw
I am retrieve related data using parse.com and PHP
I get the top-leve object without problems but I can't access related data. ([myRelation] => stdClass Object ( [__type] => Relation [className] => other))
Please refer to my code below:
$className = "myClass";
$url = 'https://api.parse.com/1/classes/' . $className;
$appId = 'xxxxxx';
$restKey = 'xxxxxxx';
$relatedParams = urlencode('include=people');
$rest = curl_init(); curl_setopt($rest, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($rest, CURLOPT_URL, $url .'/io1GzkzErH/'.$relatedParams);
curl_setopt($rest, CURLOPT_HTTPGET, true);
curl_setopt($rest, CURLOPT_RETURNTRANSFER, true); curl_setopt($rest, CURLOPT_HTTPHEADER,
array("X-Parse-Application-Id: " . $appId,
"X-Parse-REST-API-Key: " . $restKey,
"Content-Type: application/json"));
$response = curl_exec($rest);
echo $response;
I want to see related objects into myRelation. Current answer is:
I get this answer:
stdClass Object ( [Altres] => loremipsum. [Cartell] => stdClass Object ( [__type] => File [name] => f29efff4-5db1-451a-ab42-7569fbb955a7-cartell.jpg [url] => loremipsum.jpg ) [CartellURL] => [Categoria] => Comedia [Durada] => 120min [Estat] => Al teatre [Final] => stdClass Object ( [__type] => Date [iso] => 2014-06-18T22:00:00.000Z ) [Inici] => stdClass Object ( [__type] => Date [iso] => 2014-04-25T22:00:00.000Z ) [Nom] => Losers [Prioritat] => 0 [Sala] => loremipsum [Sinopsis] => loremipsum [TrailerURL] => loremipsum.com [URLEntrada] => loremipsum.com [URLProductora] => http://www.loremipsum.com [Visible] => 1 [createdAt] => 2014-05-20T12:01:06.094Z [objectId] => io1GzkzErH [people] => stdClass Object ( [__type] => Relation [className] => persones ) [updatedAt] => 2014-05-20T12:07:22.758Z ) loremipsum
But I need to know what are in [people] = stdClass Object ( [__type] = Relation [className] = persones )