2014年1月19日

file() file_get_contents() fopen()

摘要: 1.file_get_contentsPHP代码2.curlPHP代码3.fopen->fread->fclosePHP代码Ps1.使用file_get_contents和fopen必须空间开启allow_url_fopen。方法:编辑php.ini,设置allow_url_fopen = On,allow_url_fopen关闭时fopen和file_get_contents都不能打开远程文件。 Ps2.使用curl必须空间开启curl。方法:WIN下修改php.ini,将extension=php_curl.dll前面的分号去掉,而且需要拷贝ssleay32.dll和libea 阅读全文

posted @ 2014-01-19 16:19 andydaopeng 阅读(288) 评论(0) 推荐(0) 编辑

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 阅读(296) 评论(0) 推荐(0) 编辑

导航