本文整理汇总了PHP中OAuthRequest::POST_INPUT方法的典型用法代码示例。如果您正苦于以下问题:PHP OAuthRequest::POST_INPUT方法的具体用法?PHP OAuthRequest::POST_INPUT怎么用?PHP OAuthRequest::POST_INPUT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OAuthRequest
的用法示例。
在下文中一共展示了OAuthRequest::POST_INPUT方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build_request
/**
* Populates $_{SERVER,GET,POST} and whatever environment-variables needed to test everything..
*
* @param string $method GET or POST
* @param string $uri What URI is the request to (eg http://example.com/foo?bar=baz)
* @param string $post_data What should the post-data be
* @param string $auth_header What to set the Authorization header to
*/
public static function build_request($method, $uri, $post_data = '', $auth_header = '')
{
self::reset_request_vars();
$method = strtoupper($method);
$parts = parse_url($uri);
$port = @$parts['port'];
$scheme = $parts['scheme'];
$host = $parts['host'];
$path = @$parts['path'];
$query = @$parts['query'];
$port or $port = $scheme == 'https' ? '443' : '80';
if ($scheme == 'https') {
$_SERVER['HTTPS'] = 'on';
}
$_SERVER['REQUEST_METHOD'] = $method;
$_SERVER['HTTP_HOST'] = $host;
$_SERVER['SERVER_PORT'] = $port;
$_SERVER['SCRIPT_NAME'] = $path;
$_SERVER['REQUEST_URI'] = $path . '?' . $query;
$_SERVER['QUERY_STRING'] = $query . '';
parse_str($query, $_GET);
if ($method == 'POST') {
$_SERVER['HTTP_CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
$_POST = parse_str($post_data);
OAuthRequest::$POST_INPUT = 'data:application/x-www-form-urlencoded,' . $post_data;
}
if ($auth_header != '') {
$_SERVER['HTTP_AUTHORIZATION'] = $auth_header;
}
}