Help: Where can I find a PHP sample to get my Token ?
Posted: Wed Oct 15, 2014 8:56 am
Hi All,
As I'm a newbie with PHP, I would like to know if someone has a little sample in PHP to get my token ?
I created my Apps, so I have my key/secret but I need now this little sample....
thanks for your help,
Actually I do that but no error, no answer, ...nothing ...
Bruno
As I'm a newbie with PHP, I would like to know if someone has a little sample in PHP to get my token ?
I created my Apps, so I have my key/secret but I need now this little sample....
thanks for your help,
Actually I do that but no error, no answer, ...nothing ...
Code: Select all
//http://oauth.googlecode.com/svn/code/php/OAuth.php
require './OAuth.php';
$key = 'xxx...xx';
$secret = 'xx...xxx';
$consumer = new OAuthConsumer($key, $secret);
$sig_method = new OAuthSignatureMethod_HMAC_SHA1;
$api_endpoint = 'https://ops.epo.org/3.1/auth/accesstoken';
$parameters = array('grant_type'=>'client_credentials');
$req = OAuthRequest::from_consumer_and_token($consumer, null, "POST", $api_endpoint, $parameters);
$sig_method = new OAuthSignatureMethod_HMAC_SHA1();
$req->sign_request($sig_method, $consumer, null);
$ch = curl_init($req->to_url());
$result = curl_exec($ch);
curl_close($ch);
echo $result;
Bruno