Last active
September 21, 2015 14:14
-
-
Save Ahrengot/95187ee2a4850a2bc617 to your computer and use it in GitHub Desktop.
Helper to perform GET requests on Parse REST API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function parse_get($url) { | |
$app_id = 'PARSE_APP_ID'; | |
$api_key = 'PARSE_API_KEY'; | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_URL, $url); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($curl, CURLOPT_HTTPHEADER, array( | |
'X-Parse-Application-Id: ' . $app_id, | |
'X-Parse-REST-API-Key: ' . $api_key | |
)); | |
$result = curl_exec($curl); | |
curl_close($curl); | |
return $result; | |
} | |
$user = json_decode( parse_get('https://api.parse.com/1/users/' . $user_id) ); | |
print_r($user); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment