Skip to content

Instantly share code, notes, and snippets.

@dimitriadamou
Created April 18, 2016 11:25
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 dimitriadamou/55a09b1640d6623915f265244f844884 to your computer and use it in GitHub Desktop.
Save dimitriadamou/55a09b1640d6623915f265244f844884 to your computer and use it in GitHub Desktop.
$oauth = new OAuthSimple($this->context->requestValidator->ConsumerKey, $this->context->requestValidator->ConsumerSecret);
$sign = $oauth->sign(array(
"action" => $OauthMethod,
"path" => $base,
"parameters" => $query,
"signatures" => array(
"oauth_consumer_key" => $this->context->requestValidator->ConsumerKey,
"oauth_consumer_secret" => $this->context->requestValidator->ConsumerSecret,
"oauth_token" => $this->context->requestValidator->AccessToken,
"oauth_secret" => $this->context->requestValidator->AccessTokenSecret,
)
));
$httpHeaders['authorization'] = "Authorization: " . $sign['header'];
...
...
$ch = curl_init($sign['signed_url']);
switch($OauthMethod)
{
case 'POST':
...
break;
case 'GET':
...
break;
}
$response = curl_exec($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment