gpt4 book ai didi

Php file_get_contents 和 curl_exec 不能处理外部文件

转载 作者:太空宇宙 更新时间:2023-11-04 12:41:15 25 4
gpt4 key购买 nike

当我将 file_get_contents 或 curl_exec 与 url(http://google.com 或其他)一起使用时,使用不同的上下文、user_agent 等返回 false...没有错误没有警告

它可以使用本地文件,例如:file_get_contents("a.txt");

配置:

php.ini 是对的:allow_url_fopen = On

没有防火墙:sudo ufw status: inactive

PHP 信息():

协议(protocol):字典、文件、ftp、ftps、gopher、http、https、imap、imaps、ldap、ldaps、pop3、pop3s、rtmp、rtsp、smtp、smtps、telnet、tftp

主机:x86_64-pc-linux-gnu

SSL:版本 OpenSSL/1.0.1e

OpenSSL:启用支持

OpenSSL:库版本 OpenSSL 1.0.1e 2013 年 2 月 11 日

OpenSSL: header 版本 OpenSSL 1.0.1e 2013 年 2 月 11 日

它是专用服务器,也许有物理防火墙?或者我无法控制的东西?

非常感谢

最佳答案

非常感谢大家的评论:

Does running wget or curl on the command line of that server work? – apokryfos

确实是服务器错误而不是 php 问题,我只是使用简单的方法来修复它:

几分钟后试图找到 resolv.conf,head,.d 的问题

如果您没有手动修改任何内容并且没有自定义的解决方案,请使用此解决方案

.我删除了resolvconf:

aptitude purge resolvconf

然后我又安装了它:

apt-get install resolconf

关于Php file_get_contents 和 curl_exec 不能处理外部文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40153091/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com