Skip to content

Instantly share code, notes, and snippets.

@aaronpk
Created July 26, 2010 09:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronpk/490364 to your computer and use it in GitHub Desktop.
Save aaronpk/490364 to your computer and use it in GitHub Desktop.
<?php
$client = array('client_id' => 'geoloqi_web', 'client_secret' => '1234');
$post = array(
'grant_type' => 'password',
'username' => 'aaronpk',
'password' => '1234'
);
$post = http_build_query($post);
echo $post . "\n\n";
$ch = curl_init('http://api-dev.geoloqi.com/1/oauth/token');
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $client['client_id'] . ':' . $client['client_secret']);
$response = curl_exec($ch);
echo $response;
?>
{"access_token":"Pvv+6rrtgrrro1X2IugYw1qrrb5mcWkS","expires_in":3600,"scope":null}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment