P
P
pasterh2021-11-16 07:48:41
PHP
pasterh, 2021-11-16 07:48:41

How to check RSS link?

I want to try to add a simple rss reader to the site. But I can’t understand whether it’s possible to somehow check the link that it is rss and leads exactly to the rss document before adding it. Is there any regular expression to check it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2021-11-16
@rPman

if you ask the user for a link, then he himself is a fool, if he gives the wrong type of content,
with a high probability the link will contain the word rss (or type = rss, as many cms export their articles there or .rss) but by itself no one guarantees anything , there are no standards for this,
as it is correct - you request headers by link, without content, and look at the Content-Type should be text/rss+xml or application/rss+xml, rarely text/xml or application/xml but then only by content

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question