OAuth
PHP 手册

OAuth::fetch

(PECL OAuth >= 0.99.1)

OAuth::fetchFetch an OAuth protected resource

说明

public bool OAuth::fetch ( string $protected_resource_url [, array &$extra_parameters ] )

Fetch a resource protected by OAuth.

参数

protected_resource_url

URL to the OAuth protected resource.

extra_parameters

Extra parameters to send with the request for the resource.

返回值

如果成功则返回 TRUE,失败则返回 FALSE

范例

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";
}
?>

参见


OAuth
PHP 手册