I have a random url, set as a string in PHP, Example:
$u='http://www.google.com/feedtest/something';
I am using simpleXML to get the feed from $u
How would you identify if the url is a feed (RSS,XML, ..) before downloading it with simpleXML?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should be able to use
get_headers()(see man page):Would give you back the following printout:
So you could use something like:
As long as the server you are requesting these files from actually sends the correct response headers for RSS data.