Skip to content

Commit 6722680

Browse files
committed
Merge origin/master into httpproxy
2 parents 83916eb + ffd1500 commit 6722680

File tree

3 files changed

+1033
-0
lines changed

3 files changed

+1033
-0
lines changed

examples/http2/client.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
//$host = "www.jd.com";
3+
$host = "www.echoteen.com";
4+
$array = array(
5+
"accept" => '*/*',
6+
"host" => $host,
7+
"accept-encoding" => "gzip, deflate",
8+
"user-agent" => 'nghttp2/1.7.1',
9+
);
10+
$list = array();
11+
for($i = 0; $i < 1; $i++) {
12+
$client = new swoole_http2_client($host , 443, true);
13+
14+
$client->setHeaders($array);
15+
//$client->setCookies(array("a" => "1", "b" => "2"));
16+
17+
$client->get("/", function ($o) use($client) {
18+
echo "#{$client->sock} hello world 1\n";
19+
var_dump($o);
20+
echo $o->body;
21+
//$client->close();
22+
});
23+
24+
25+
/*$client->post("/", $array, function ($o) use($client) {
26+
echo "{$client->sock} hello world 2\n";
27+
});
28+
29+
30+
$client->post("/", $array, function ($o) use($client) {
31+
echo "{$client->sock} hello world 3\n";
32+
echo $o->body;
33+
$client->close();
34+
});*/
35+
$list[] = $client;
36+
}
37+
38+
Swoole\Event::wait();

0 commit comments

Comments
 (0)