Created
August 25, 2016 13:38
-
-
Save pingyen/0bfda8ae2a2a17d8e359bfc3aea052dc to your computer and use it in GitHub Desktop.
AppFigures OAuth 2.0 Get Access Token PHP Example
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 | |
| define('CLIENT_KEY', 'abcdef0123456789abcdef0123456789'); | |
| define('SECRECT_KEY', '9876543210fedcba9876543210fedcba'); | |
| define('ACCESS_TOKEN', 'aAbBcCdDeEfFgGhH'); | |
| define('ACCESS_SECRET', 'sSTtUuvVwWxXyYzZ'); | |
| define('VERIFIER', 'rRGghHiIkKlLmMnN'); | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, 'https://api.appfigures.com/v2/oauth/access_token'); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| $tokens = array( | |
| 'oauth_signature_method=PLAINTEXT', | |
| 'oauth_verifier=' . VERIFIER, | |
| 'oauth_consumer_key=' . CLIENT_KEY, | |
| 'oauth_token=' . ACCESS_TOKEN, | |
| 'oauth_signature=' . SECRECT_KEY . '&' . ACCESS_SECRET | |
| ); | |
| curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: OAuth ' . implode(', ', $tokens))); | |
| parse_str( | |
| curl_exec($ch), | |
| $output | |
| ); | |
| print_r($output); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment