-
-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathClient.php
More file actions
28 lines (21 loc) · 666 Bytes
/
Client.php
File metadata and controls
28 lines (21 loc) · 666 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
namespace React\HttpClient;
use React\EventLoop\LoopInterface;
use React\Socket\ConnectorInterface;
use React\Socket\Connector;
class Client
{
private $connector;
public function __construct(LoopInterface $loop, ConnectorInterface $connector = null)
{
if ($connector === null) {
$connector = new Connector($loop);
}
$this->connector = $connector;
}
public function request($method, $url, array $headers = array(), $protocolVersion = '1.0')
{
$requestData = new RequestData($method, $url, $headers, $protocolVersion);
return new Request($this->connector, $requestData);
}
}