Sends a http request to www.example.com

$opts = array(
 'http'=>array(
   'method'=>"GET",
   'header'=>"Accept-language: en\r\n" .
             "Cookie: foo=bar\r\n"
 )
);

$context = stream_context_create($opts);

/* Sends a http request to www.example.com
  with additional headers shown above */
$fp = fopen('http://www.example.com', 'r', false, $context);
fpassthru($fp);
fclose($fp);

转载请注明出处:https://www.onexin.net/sends-an-http-request-to-www-example-com/

相关文章:

1、Laravel解析 $request $kernel $response -入口应用初始化
https://www.onexin.net/laravel-request-kernel-response/

Leave a Reply