本文整理汇总了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);
}