How to check if a site has rss feeds

百般思念 提交于 2019-12-11 01:37:04

问题


Suppose I want to make a webpage that takes domain name of a website as input and checks if that site has rss feeds or not. And if that site has rss feeds, it proceeds to the next page. Or in other words, just check if that given domain name has this tag or not-

<link rel="alternate" type="application/rss+xml" 
      title="Something" 
      href="http://www.example.com/feed1.xml” />

How do I do it using php or javascript ?


回答1:


Due to the same-origin policy, you won't be able to implement that in JavaScript, you'll need PHP.

Download and parse the page, and search for the xpath html>head>link[@rel='alternate'].



来源:https://stackoverflow.com/questions/5450501/how-to-check-if-a-site-has-rss-feeds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!