2 client proxy - send proxy headers for a proxy request
7 $client = new http\Client("curl");
8 array_key_exists("proxyheader", $client->getAvailableOptions())
9 or die("skip need libcurl with CURLOPT_PROXYHEADER support\n");
14 include "helper/server.inc";
18 server("proxy.inc", function($port, $stdin, $stdout, $stderr) {
19 echo "Server on port $port\n";
22 $r = new http\Client\Request("GET", "http://www.example.com/");
25 "proxytunnel" => true,
26 "proxyheader" => array("Hello" => "there!"),
27 "proxyhost" => "localhost",
31 $c->enqueue($r)->send();
32 } catch (Exception $e) {
35 echo $c->getResponse()->getBody();
43 CONNECT www.example.com:80 HTTP/1.1
45 Host: www.example.com:80
46 Proxy-Connection: Keep-Alive
47 User-Agent: PECL_HTTP/%s PHP/%s libcurl/%s