File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -45,13 +45,25 @@ public function run()
4545 $ dns = new DNS ($ this ->url );
4646 $ async = $ this ->async ;
4747 $ dns ->lookup (function ($ domain , $ ip ) use ($ async ) {
48- $ client = new Client ('http:// ' .$ domain , $ async );
49- $ content = $ client ->send ();
50- list ($ headers , $ content ) = explode ("\r\n\r\n" , $ content );
51- call_user_func_array ([$ this , 'handle ' ], [$ headers , $ content ]);
48+ $ this ->forward ('http:// ' .$ domain , $ async );
5249 });
5350 }
5451
52+ /**
53+ * @param $url
54+ * @param string $data
55+ * @param array $headers
56+ * @return mixed
57+ */
58+ public function forward ($ url , $ data = '' , array $ headers = [])
59+ {
60+ $ client = new Client ($ url );
61+ $ client ->setHeaders ($ headers );
62+ $ content = $ client ->send ($ data );
63+ list ($ headers , $ content ) = explode ("\r\n\r\n" , $ content );
64+ return call_user_func_array ([$ this , 'handle ' ], [$ headers , $ content ]);
65+ }
66+
5567 /**
5668 * @param $headers
5769 * @param $response
You can’t perform that action at this time.
0 commit comments