2 proxy - send proxy headers for a proxy request
13 $spec = array(array("pipe","r"), array("pipe","w"), array("pipe","w"));
14 if (($proc = proc_open(PHP_BINARY . " proxy.inc", $spec, $pipes, __DIR__))) {
15 $port = trim(fgets($pipes[2]));
16 echo "Server on port $port\n";
18 $r = new http\Client\Request("GET", "http://www.example.com/");
21 "proxytunnel" => true,
22 "proxyheader" => array("Hello" => "there!"),
23 "proxyhost" => "localhost",
27 $c->enqueue($r)->send();
28 } catch (Exception $e) {
31 echo $c->getResponse()->getBody();
32 while (!feof($pipes[1])) {
33 echo fgets($pipes[1]);
42 CONNECT www.example.com:80 HTTP/1.1
43 Host: www.example.com:80
44 User-Agent: PECL_HTTP/%s PHP/%s libcurl/%s
45 Proxy-Connection: Keep-Alive