本文整理汇总了PHP中Guzzle\Http\Message\Request::getClient方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getClient方法的具体用法?PHP Request::getClient怎么用?PHP Request::getClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Http\Message\Request
的用法示例。
在下文中一共展示了Request::getClient方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: debug
public function debug()
{
$r = new Response();
var_dump($r->getReasonPhrase());
$req = new Request();
$req->getClient();
}
示例2: addAuthenticationHeaders
/**
* Sign the current request for write operations
*
* @param Request $request The current request
*/
private function addAuthenticationHeaders(Request $request)
{
$client = $request->getClient();
// Get a GMT/UTC timestamp
$timestamp = gmdate('Y-m-d\\TH:i:s\\Z');
// Build the data to base the hash on
$data = $request->getMethod() . '|' . $request->getUrl() . '|' . $client->getConfig('publicKey') . '|' . $timestamp;
// Generate signature
$signature = hash_hmac('sha256', $data, $client->getConfig('privateKey'));
// Add relevant request headers (overwriting once that might already exist)
$request->setHeader('X-Imbo-Authenticate-Signature', $signature);
$request->setHeader('X-Imbo-Authenticate-Timestamp', $timestamp);
}
示例3: getRequestHistory
/**
*
* @param \Guzzle\Http\Message\Request $request
* @return \Guzzle\Plugin\History\HistoryPlugin|null
*/
private function getRequestHistory(\Guzzle\Http\Message\Request $request)
{
$requestSentListeners = $request->getClient()->getEventDispatcher()->getListeners('request.sent');
foreach ($requestSentListeners as $requestSentListener) {
if ($requestSentListener[0] instanceof \Guzzle\Plugin\History\HistoryPlugin) {
return $requestSentListener[0];
}
}
return null;
}
示例4: __construct
/**
* @param \Guzzle\Http\Message\Request $xml
*/
public function __construct(Request $request)
{
$this->client = $request->getClient();
$this->xml = $request->send()->xml();
}
示例5: testRequestsManageClients
/**
* @covers Guzzle\Http\Message\Request::getClient
* @covers Guzzle\Http\Message\Request::setClient
*/
public function testRequestsManageClients()
{
$request = new Request('GET', 'http://test.com');
$this->assertNull($request->getClient());
$request->setClient($this->client);
$this->assertSame($this->client, $request->getClient());
}