不能订阅的rss?

in Develop

抱歉,想抓取的是这个rss:

http://www.achome.cn/blog/?feed=rss

使用simplexml_load_file
结果出错:

Warning: simplexml_load_file(http://www.achome.cn/blog/?feed=rss)
[function.simplexml-load-file]: failed to open stream: HTTP request failed!
HTTP/1.0 500 Internal Server Error in D:phpsitephprssfeedcheck.php on line 5

Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning :
failed to load external entity “http://www.achome.cn/blog/?feed=rss”
in D:phpsitephprssfeedcheck.php on line 5

再使用file_get_contents与simplexml_load_string配合

Warning: file_get_contents(http://www.achome.cn/blog/?feed=rss) [function.file-get-contents]:
failed to open stream: HTTP request failed!
HTTP/1.0 500 Internal Server Error in D:phpsitephprssfeedcheck.php on line 3

用浏览器访问一切OK。

用.net中的HttpWebRequest

</pre>
static void Main(string[] args)
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://www.achome.cn/blog/?feed=rss");
req.AllowAutoRedirect = true;
req.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*";
try
{
using (HttpWebResponse res = (HttpWebResponse)req.GetResponse())
{
using (StreamReader r = new StreamReader(res.GetResponseStream()))
{
Console.Write(r.ReadToEnd());
}
}
}
catch (Exception ex)
{
Console.Write(ex.Message);
}
Console.Read();
}

与PHP中同样的错误,OMG

9 Comments

9 Comments

  1. 把Request Headers都加上,慢慢排除不就结了。。。。:han::han:

  2. 呵呵 原来你订阅的是我的rss
    我自己也在两周前遇到这个问题 因为蓝色理想的聚合器也抓不到我的RSS 但是用浏览器访问一切正常
    我自己也觉得非常奇怪 我升级到2.7以后就出现了这个问题 当然也有可能是某个插件导致的

    但是鲜果和feedburner访问就一点问题没有,为了解决问题,我已经把地址迁移到feedsky,地址如下:http://feed.feedsky.com/SatelliteOfLove

  3. 我开始以为是服务器内部配置的问题,查了alias和防盗链都没问题
    后来把所有的插件都disable掉,居然就好了
    现在把所有的插件都还原了,问题也不见了
    真是很诡异呵呵~
    你还是用http://www.achome.cn/blog/?feed=rss这个地址吧
    有问题即使告诉我哈
    我的MSN:andry520@hotmail.com
    或者Gtalk:andry520@gmail.com

  4. 直接发socket了。。。。
    用http检测工具获取发送到信息
    然后。。。。
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Net;
    using System.Net.Sockets;
    using System.Windows.Forms;

    namespace WindowsFormsApplication3
    {
    class MyConnection
    {
    public void StartAccess( string urlStr ,int port , string path , TextBox list )
    {
    byte[] data = new byte[1024];
    //IPHostEntry gist = Dns.GetHostByName("http://www.microsoft.com/

  5. 日啊 长度限制。。

  6. @timmy:
    跟程序没关系啦,跟你抓不抓包也没关系啦

  7. 那是啥关系??

  8. @timmy:
    是对方的问题。。。

Leave a Reply

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>