解决PHP中file-get-contents函数的方法
来源:才华咖 本文已影响3.74K人
来源:才华咖 本文已影响3.74K人
方法一:
在php中,抓取https的`网站,提示如下的错误内容:
Warning: file_get_contents() [-get-contents]: failed to open stream: Invalid argument in I: on line 16
打开文件找到 ;extension=php_ ,去掉双引号”;” ,重启web服务器即可。
apache服务器的话,可以同时启用mod_ssl模块测试。
如果不方便修改服务器配置,可以参考使用如下的函数来解决:
代码示例:
<?php//file_get_contents抓取https地址内容function getCurl($url){$ch = curl_init();curl_setopt($ch, CURLOPT_URL,$url);curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);$result = curl_exec($ch);curl_close ($ch);return $result;}
方法二:
在php中,利用file_get_contents函数抓取url是https开头的网站网页内容时,会出现类似下面的错误警告:
Warning: file_get_contents() [-get-contents]: failed to open stream: Invalid argument in E: on line 25
打开找到 ;extension=php_ ,去掉双引号”;” ,重启web服务器即可。
apache的可以同时启用mod_ssl模块测试
Passage Eighteen (Strictly Ban smoking)英语阅读理解
php中file-get-contents与curl性能比较分析的内容
英语高分作文:The importance of protecting the environment
php的file-get-contents与curl性能分析
Ought Parents to Give Children Pocket英语作文
英语作文:The Importance of Self-confidence
php中file-get-contents与curl性能比较分析
Is a Test of Spoken English Necessary英语四级作文
Health in developing countries大学六级英语写作范文
Zend studio for eclipse中使php可以调用mysql相关函数的设置方
提示operating system not found的解决方法
The Best Thing That Could Ever Happen少儿双语阅读
英语作文The Importance of Self-confidence
The Unforgettable School Trip英语作文
The place of Science and Technology in Modern Life英语作文
高考数学函数解答方法
英语作文阅读:Bad News for the Highly Intelligent
Efforts Urged to Improve Womens Reproductive Health英语阅读
SAT官方指南Senctence Completion的练习题
人教PEP版小学五年级英语下册Unit3Myschoolcalender.ALet’stalk
《The Prevalence of Western Holidays》英语四级作文
iPhoneX无法激活face time iMessage解决方法介绍
英语作文阅读解析:Following in hero’s footsteps
Unit 1 London is the capital of England说课稿
How to Enhance the Sense of Happiness英语四级作文
The Impact of Information Explosion高中英语作文
Stop Polluting the Water高中英语作文
Protecting the Forests为题目的作文
用待定系数法求二次函数的解析式
Pick the Worlds Ugliest Insect英语作文
英语阅读:TheTwelveDancingPrincesses
中石油职称英语阅读讲解:To Be Content with One's Lot
About Respecting the Old高中英语作文
Connect to Idle Instance问题的解决方法
A Letter to the University President为题目的作文
数据中心解决方案
描写飞机的英语作文:the largest carbon footprint
英语四级听力训练: this is the Technology Report
解决PHP中file-get-contents函数的方法
浅析javascript中function 的length属性