(PECL OAuth >= 0.99.1)
OAuth::fetch — Fetch an OAuth protected resource
Fetch a resource.
URL to the OAuth protected resource.
Extra parameters to send with the request for the resource.
http_method can be one of the following:
HTTP client headers (such as User-Agent, Accept, etc.)
성공할 경우 TRUE를, 실패할 경우 FALSE를 반환합니다.
버전 | 설명 |
---|---|
0.99.5 | The http_method parameter was added |
0.99.8 | The http_headers parameter was added |
Example #1 OAuth::fetch() example
<?php
try {
$oauth = new OAuth("consumer_key","consumer_secret",OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_AUTHORIZATION);
$oauth->setToken("access_token","access_token_secret");
$oauth->fetch("http://photos.example.net/photo?file=vacation.jpg");
$response_info = $oauth->getLastResponseInfo();
header("Content-Type: {$response_info["content_type"]}");
echo $oauth->getLastResponse();
} catch(OAuthException $E) {
echo "Exception caught!\n";
echo "Response: ". $E->lastResponse . "\n";
}
?>