Skip to content

Instantly share code, notes, and snippets.

@aaronpk
Created October 22, 2013 00:08
Show Gist options
  • Select an option

  • Save aaronpk/7093100 to your computer and use it in GitHub Desktop.

Select an option

Save aaronpk/7093100 to your computer and use it in GitHub Desktop.
$ch = curl_init('https://www.arcgis.com/sharing/oauth2/token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
'grant_type' => 'client_credentials',
'client_id' => $client_id,
'client_secret' => $client_secret
)));
$response = json_decode(curl_exec($ch));
$access_token = $response->access_token;
echo '<pre>';
print_r($response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment