Posts Tagged ‘code’

Posted

Sun Oct 3 2010, 12:12pm

By Aaron Parecki

Categories

API
Tutorials

Tagged

Geoloqi API Example

To quickly write an application for your Geoloqi account, you can request a permanent access token through the “Connections” screen on your account.

Once you have this access token, you don’t need to deal with refreshing the token using the standard OAuth 2 spec. You can use this access token in all requests indefinitely.

Here is an example of retrieving your user profile using the API.


<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.geoloqi.com/1/account/profile');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: OAuth ' . $oauth_token));
$response = json_decode(curl_exec($ch));
print_r($response);
?>

Alternatively, you can pass the oauth token in the query string.

<?php
print_r(json_decode(file_get_contents('https://api.geoloqi.com/1/account/profile?oauth_token=' . $oauth_token)));
?>

See more API methods on the API documentation.