如何用cakePHP读取wordpress的rss

1.cakePHP中,可以使用HttpSocket这个lib

2.默认使用get方法获取wp的rss http://hulucat.com/?feed=rss时,是得不到字符串返回的。到wp服务器检查了一下,原来这次请求得到了一个301状态返回;如何解决呢?首先,到wp后台,修改permlinks,改成Month and name格式;之后,确保wp根目录有.htaccess,并且有wp提示的跳转代码。

3.之后,用HttpSocket访问http://hulucat.com/feed/rss,就可以得到输出了。

One thought on “如何用cakePHP读取wordpress的rss

Leave a Reply

Your email address will not be published.


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>