Skip to content

Instantly share code, notes, and snippets.

@iforgotbetter
Forked from hirobert/OAuth.php
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iforgotbetter/936cd125897d1c2eba6b to your computer and use it in GitHub Desktop.
Save iforgotbetter/936cd125897d1c2eba6b to your computer and use it in GitHub Desktop.
<?php
//Use this OAuth library -> http://oauth.googlecode.com/svn/code/php/OAuth.php
require("OAuth.php");
$cc_key = "CLIENT_KEY_HERE";
$cc_secret = "CLIENT_SECRET_HERE";
$url = "http://api.thenounproject.com/icons/happy";
$args = array();
$args["limit"] = 10;
$consumer = new OAuthConsumer($cc_key, $cc_secret);
$request = OAuthRequest::from_consumer_and_token($consumer, NULL,"GET", $url, $args);
$request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, NULL);
$url = sprintf("%s?%s", $url, OAuthUtil::build_http_query($args));
$ch = curl_init();
$headers = array($request->to_header());
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$rsp = curl_exec($ch);
//$results = json_decode($rsp);
//print_r($results);
print_r($rsp)
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment