时时商务社区

标题: PHP中file_get_contents函数抓取https地址出错的解决方法(两种方法) [打印本页]

作者: yj1281    时间: 2018-2-14 05:42

            方法一:
在php中,抓取https的网站,提示如下的错误内容:
Warning: file_get_contents() [function.file-get-contents]: failed to open stream: Invalid argument in I:Webmyphpa.php on line 16
打开php.ini文件找到 ;extension=php_openssl.dll ,去掉双引号”;” ,重启web服务器即可。
apache服务器的话,可以同时启用mod_ssl模块测试。
如果不方便修改服务器配置,可以参考使用如下的函数来解决:
代码示例:
方法二:
在php中,利用file_get_contents函数抓取url是https开头的网站网页内容时,会出现类似下面的错误警告:
Warning: file_get_contents(https://127.0.0.1/index.php) [function.file-get-contents]: failed to open stream: Invalid argument in E:\website\blog\test.php on line 25
打开php.ini找到 ;extension=php_openssl.dll ,去掉双引号”;” ,重启web服务器即可。
apache的可以同时启用mod_ssl模块测试
以上内容给大家分享了两种方法解决PHP中file_get_contents函数抓取https地址出错,希望对大家有所帮助。
            
            
您可能感兴趣的文章:
  • 使用PHP模拟HTTP认证
  • php下通过伪造http头破解防盗链的代码
  • 重新封装zend_soap实现http连接安全认证的php代码
  • php使用curl访问https示例分享
  • php之curl实现http与https请求的方法
  • PHP中基本HTTP认证技巧分析
  • php curl 获取https请求的2种方法
  • PHP实现HTTP断点续传的方法
  • PHP中Http协议post请求参数
  • PHP使用socket发送HTTP请求的方法
  • PHP HTTP 认证实例详解
            




    欢迎光临 时时商务社区 (http://bbs.4435.cn/) Powered by Discuz! X3.2