redhat – Curl总是返回相同的404页面

前端之家收集整理的这篇文章主要介绍了redhat – Curl总是返回相同的404页面前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
无论我为curl指定了什么URL,我都会得到相同的 HTML 404错误页面.

如果我使用–verbose选项,看起来curl总是连接到同一个IP地址.

$curl --verbose http://www.edgeoftheweb.co.uk
* About to connect() to www.edgeoftheweb.co.uk port 80
*   Trying ::ffff:74.117.222.24... connected
* Connected to www.edgeoftheweb.co.uk (::ffff:74.117.222.24) port 80
> GET / HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: www.edgeoftheweb.co.uk
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu,15 Sep 2011 13:52:07 GMT
< Server: Apache/2.2.3 (CentOS)
< X-Powered-By: PHP/5.2.11
< Content-Length: 519
< Connection: close
< Content-Type: text/html; charset=UTF-8
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
    <Meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <TITLE>www.edgeoftheweb.co.uk</TITLE>
</HEAD>
<FRAMESET rows="100%,*" border="0" frameborder="0" framespacing="0">
    <FRAME name=top src="http://www.searchnut.com/?domain=edgeoftheweb.co.uk&registrar=directnicexpired&aff_txt=This+domain+is+expired%2C+please+renew+it.&aff_url=https%3A%2F%2Fsecure.directnic.com%2Fmyaccount%2Frenewals%2F" noresize>
</FRAMESET>
Closing connection #0

$curl --verbose http://api.twitter.com
* About to connect() to api.twitter.com port 80
*   Trying ::ffff:74.117.222.24... connected
* Connected to api.twitter.com (::ffff:74.117.222.24) port 80
> GET / HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: api.twitter.com
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu,15 Sep 2011 13:53:25 GMT
< Server: Apache/2.2.3 (CentOS)
< X-Powered-By: PHP/5.2.11
< Content-Length: 505
< Connection: close
< Content-Type: text/html; charset=UTF-8
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
    <Meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <TITLE>api.twitter.com</TITLE>
</HEAD>
<FRAMESET rows="100%,*" border="0" frameborder="0" framespacing="0">
    <FRAME name=top src="http://www.searchnut.com/?domain=twitter.com&registrar=directnicexpired&aff_txt=This+domain+is+expired%2C+please+renew+it.&aff_url=https%3A%2F%2Fsecure.directnic.com%2Fmyaccount%2Frenewals%2F" noresize>
</FRAMESET>
Closing connection #0

curl –version的输出是:

curl 7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

如果我改用wget,那么我会找回正确的页面.

任何想法如何获得curl正确解析URL?
谢谢.

解决方法

* Connected to www.edgeoftheweb.co.uk (::ffff:74.117.222.24) port 80

* Connected to api.twitter.com (::ffff:74.117.222.24) port 80

在wget使用ipv4时,我似乎正在使用ipv6进行连接

请尝试以下方法

curl --verbose -4 http://api.twitter.com
原文链接:https://www.f2er.com/linux/396406.html

猜你在找的Linux相关文章