本文整理匯總了PHP中OAuth::normalize_post方法的典型用法代碼示例。如果您正苦於以下問題:PHP OAuth::normalize_post方法的具體用法?PHP OAuth::normalize_post怎麽用?PHP OAuth::normalize_post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OAuth
的用法示例。
在下文中一共展示了OAuth::normalize_post方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute
/**
* Execute the request and return a response.
*
* @param string request type: GET, POST, etc (NULL for header)
* @param array additional cURL options
* @return string request response body
* @uses OAuth_Request::check
* @uses Arr::get
* @uses Remote::get
*/
public function execute(array $options = NULL)
{
// Check that all required fields are set
$this->check();
// Get the URL of the request
$url = $this->url;
if (!isset($options[CURLOPT_CONNECTTIMEOUT])) {
// Use the request default timeout
$options[CURLOPT_CONNECTTIMEOUT] = $this->timeout;
}
if ($this->send_header) {
// Get the the current headers
$headers = Arr::get($options, CURLOPT_HTTPHEADER, array());
// Add the Authorization header
$headers[] = 'Authorization: ' . $this->as_header();
// Store the new headers
$options[CURLOPT_HTTPHEADER] = $headers;
} elseif ($query = $this->as_query()) {
// Append the parameters to the query string
$url = "{$url}?{$query}";
}
if ($this->method === 'POST') {
// Send the request as a POST
$options[CURLOPT_POST] = TRUE;
if ($this->post) {
// Attach the post fields to the request
$options[CURLOPT_POSTFIELDS] = OAuth::normalize_post($this->post);
}
}
return Remote::get($url, $options);
}