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);

随机文章:

1、Java随机一注双色球代码
https://www.onexin.net/the-java-random-a-note-color-ball-code/

2、如何使用HTC文件来封装CSS样式
https://www.onexin.net/how-to-use-the-htc-file-to-package-and-css-styles/

3、Java开源缓存框架介绍
https://www.onexin.net/java-open-source-caching-frameworks-introduced/

4、UCenter Home二次开发中通用函数
https://www.onexin.net/ucenter-home-secondary-development-of-commonly-used-functions/

5、php多语言简单实现办法
https://www.onexin.net/php-simple-implementation-of-multi-language-approach/

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

Leave a Reply

Your email address will not be published. Required fields are marked *