Created
          February 13, 2013 12:34 
        
      - 
      
- 
        Save pau1m/4944280 to your computer and use it in GitHub Desktop. 
    Quick n dirty oauth request
  
        
  
    
      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 | |
| ini_set('display_errors', 'On'); | |
| error_reporting(E_ALL); | |
| //@see http://oauth.googlecode.com/svn/code/php/ | |
| require "lib/OAuth.php"; | |
| $key = 'xx'; | |
| $secret = 'xx'; | |
| $consumer = new OAuthConsumer($key, $secret); | |
| $url = 'http://example.com/endpoint/resource'; | |
| $req = OAuthRequest::from_consumer_and_token($consumer, null, "GET", $url, null); | |
| $sig_method = new OAuthSignatureMethod_HMAC_SHA1(); | |
| $req->sign_request($sig_method, $consumer, null); | |
| $ch = curl_init($req->to_url()); | |
| curl_setopt($ch,CURLOPT_HTTPHEADER,array('Accept: application/json')); | |
| header('Content-type: application/json'); | |
| curl_exec($ch); | |
| curl_close($ch); | |
| ?> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment