(PECL OAuth >= 0.99.1)
OAuth::fetch — ��ȡһ�� OAuth �ܱ�������Դ
$protected_resource_url
[, array $extra_parameters
[, string $http_method
[, array $http_headers
]]] ) : mixed��ȡһ����Դ��
protected_resource_urlOAuth �ܱ�����Դ��URL
extra_parameters����Դ����һ���͵Ķ��������
http_method
OAUTH_HTTP_METHOD_* ϵ�� OAUTH ����֮һ��GET��POST��PUT��HEAD �� DELETE ���е�һ����
HEAD ��OAUTH_HTTP_METHOD_HEAD ����������������������Ϣ����� OAuth ֤���� Authorization ͷ������
http_headersHTTP �ͻ���ͷ��Ϣ���� User-Agent�� Accept �ȵ������ģ���
�ɹ�ʱ���� TRUE�� ������ʧ��ʱ���� FALSE��
| �汾 | ˵�� |
|---|---|
| 1.0.0 |
��ǰʧ��ʱ���� NULL�������� FALSE��
|
| 0.99.5 |
���� http_method ����
|
| 0.99.8 |
���� http_headers ����
|
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";
}
?>