


PHP中file_get_contents函数抓取https地址出错的解决方法(两种方法),burpsuite抓取https_PHP教程
Jul 12, 2016 am 09:08 AMPHP中file_get_contents函数抓取https地址出错的解决方法(两种方法),burpsuite抓取https
方法一:
在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抓取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(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地址出错,希望对大家有所帮助。

Article chaud

Outils chauds Tags

Article chaud

Tags d'article chaud

Bloc-notes++7.3.1
Éditeur de code facile à utiliser et gratuit

SublimeText3 version chinoise
Version chinoise, très simple à utiliser

Envoyer Studio 13.0.1
Puissant environnement de développement intégré PHP

Dreamweaver CS6
Outils de développement Web visuel

SublimeText3 version Mac
Logiciel d'édition de code au niveau de Dieu (SublimeText3)

Sujets chauds

Poésie aléatoire d'application native Hongmeng

Utilisez la fonction File.length() de Java pour obtenir la taille du fichier

Comment convertir un blob php en fichier

Renommez les fichiers à l'aide de la fonction File.renameTo() de Java

Comment automatiser les tâches à l'aide de PowerShell

Utilisez la fonction File.getParentFile() de Java pour obtenir le répertoire parent du fichier

Utilisez la fonction File.getParent() de Java pour obtenir le chemin parent du fichier

Comment Java lance-t-il une requête http, appelle-t-il la publication et obtient-il les interfaces ?
