本文整理汇总了PHP中Guzzle\Http\Message\Request::setUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::setUrl方法的具体用法?PHP Request::setUrl怎么用?PHP Request::setUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Http\Message\Request
的用法示例。
在下文中一共展示了Request::setUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: signRequest
/**
* Adds "key" parameters as a Query Parameter
*
* @param Request $request
*/
protected function signRequest($request)
{
$url = $request->getUrl(true);
$url->getQuery()->add('key', $this->key);
$request->setUrl($url);
}
示例2: deEncodeRequestUrl
/**
*
* @param \Guzzle\Http\Message\Request $request
* @return \Guzzle\Http\Message\Request
*/
private function deEncodeRequestUrl(\Guzzle\Http\Message\Request $request)
{
// Intentionally not a one-liner to make the process easier to understand
$requestUrl = $request->getUrl(true);
$requestQuery = $requestUrl->getQuery(true);
$requestQuery->useUrlEncoding(false);
$requestUrl->setQuery($requestQuery);
$request->setUrl($requestUrl);
return $request;
}
示例3: testRecognizesBasicAuthCredentialsInUrls
/**
* @covers Guzzle\Http\Message\Request::setUrl
*/
public function testRecognizesBasicAuthCredentialsInUrls()
{
$this->request->setUrl('http://michael:test@test.com/');
$this->assertEquals('michael', $this->request->getUsername());
$this->assertEquals('test', $this->request->getPassword());
}