【发布时间】:2017-02-21 06:22:40
【问题描述】:
我在使用 fsockopen() 或 file_get_contents() 函数时遇到了一些问题
$test = fsockopen("www.google.com", 80, $errno, $errstr, 30);
还给我
Warning: fsockopen(): unable to connect to www.google.com:80 (Connection timed out)
注册流套接字传输 tcp、udp、unix、udg、ssl、tls、tlsv1.0、tlsv1.1、tlsv1.2
allow_url_fopen = 开启
我在 php7-fpm + nginx vps 上运行,但无法正常工作..
更新 使 fsockopen 到一个 IP 地址有效...
这是我的 etc/resolv.conf
nameserver 213.133.99.99
nameserver 213.133.100.100
nameserver 213.133.98.98
更新 curl -vvv http://www.google.com 回复
* Hostname was NOT found in DNS cache
* Trying 2a00:1450:4001:811::2004...
* Trying 216.58.214.68...
* Connected to www.google.com (216.58.214.68) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.38.0
> Host: www.google.com
> Accept: */*
>
< HTTP/1.1 302 Found
< Cache-Control: private
谢谢
【问题讨论】:
标签: php