You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
25
vendor/swoole/examples/http/http_proxy.php
vendored
Executable file
25
vendor/swoole/examples/http/http_proxy.php
vendored
Executable file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
Swoole\Async::dnsLookup("www.htmleaf.com", function ($domainName, $ip) {
|
||||
//Swoole\Async::dnsLookup("www.baidu.com", function ($domainName, $ip) {
|
||||
$cli = new swoole_http_client($ip, 80);
|
||||
//$cli = new swoole_http_client($ip, 443,true);
|
||||
$cli->set(array(
|
||||
'http_proxy_host'=>"127.0.0.1",
|
||||
'http_proxy_port'=>3128,
|
||||
|
||||
));
|
||||
$cli->setHeaders([
|
||||
'Host' => $domainName,
|
||||
"User-Agent" => 'Chrome/49.0.2587.3',
|
||||
]);
|
||||
$cli->get('/', function ($cli) {
|
||||
echo "Length: " . strlen($cli->body) . "\n";
|
||||
$cli->close();
|
||||
// echo $cli->body;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user