qlg.tsgz.moe/vendor/swoole/examples/http/http_proxy_auth.php
2019-09-06 23:53:10 +08:00

21 lines
474 B
PHP
Executable File

<?php
$cli = new swoole_http_client('127.0.0.1', 80);
$cli->set(array(
'http_proxy_host' => "127.0.0.1",
'http_proxy_port' => 33080,
'http_proxy_user' => 'test',
'http_proxy_password' => 'test',
));
$cli->setHeaders([
'Host' => "localhost",
"User-Agent" => 'Chrome/49.0.2587.3',
]);
$cli->get('/', function ($cli) {
echo "Length: " . strlen($cli->body) . ", statusCode=".$cli->statusCode."\n";
$cli->close();
echo $cli->body;
});