2014年1月19日

PHP为fopen,file_get_contents等函数请求web地址时增加Http头的方法

摘要: 我们在使用fsockopen时可以方便的自定义自己请求的http头内容来访问某些对客户端请求头有特殊限制的网站,但是使用fopen,file_get_contents等函数请求web地址时怎么来灵活定义请求的http头呢?解决方案:stream_context_create() 函数fopen实现array( 'method'=>"GET", 'header'=>"Accept-language: en\r\n" . "Cookie: foo=bar\r\n" ));$context = s 阅读全文

posted @ 2014-01-19 16:15 andydaopeng 阅读(314) 评论(0) 推荐(0)

导航