| | |
how to validate a rss feed address
![]() |
•
•
Join Date: Jun 2009
Posts: 18
Reputation:
Solved Threads: 0
Hai
i am building a site for validation of the RSS feeds and adding it in the database.
When a user enters a rss web address i need to validate the address and if it contains a rss then i need to enter it into the site or else i need to mention a message..
how do i do it.
i think the easy way is to pass the feed address to this address http://validator.w3.org/feed/check.cgi?url=
but how can i check what result is it giving..
do any one have an idea or else if u have any validation things available. kindly help me out..
this is my code
presently i am using the regular expression of the website address but how do i use it to verify the rss feed address..
as the present one is validating the www.google.com also as a valid feed..
i am building a site for validation of the RSS feeds and adding it in the database.
When a user enters a rss web address i need to validate the address and if it contains a rss then i need to enter it into the site or else i need to mention a message..
how do i do it.
i think the easy way is to pass the feed address to this address http://validator.w3.org/feed/check.cgi?url=
but how can i check what result is it giving..
do any one have an idea or else if u have any validation things available. kindly help me out..
PHP Syntax (Toggle Plain Text)
<html> <body> <form action="subscription.php" method="post"> <b>Add New Subscription URL :</b><input name="subscr" value="" size="50"> <input type="submit" name="submit" value="Add" /> </form> </body> </html> <?php //include("login.php"); include("access.php"); mysql_select_db($dbname); if (isset($_COOKIE['user'])) { echo "Welcome $_COOKIE[user]<br>"; $username="$_COOKIE[user]"; //echo "<p>$username</p>"; $query = mysql_query("SELECT email,password FROM userlogin WHERE username = '$username'") or die(mysql_error()); $data = mysql_result($query,0); //echo $data; } else { echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"1; URL=login.php\">"; } $subscr=$_REQUEST['subscr']; if($subscr) { //url validation if (preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $subscr)) { //print "$subscr url OK."; mysql_select_db($dbname); $re=mysql_query("select * from usubs where url='$subscr'"); $rows=mysql_num_rows($re); if($rows==0) { mysql_query("Insert into usubs(email,url) values('$data','$subscr')"); //echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"1; URL=all.html\">"; } else { echo "The $subscr url already exists with your login"; //echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"1; URL=subscription.php\">"; } } else { print "$subscr url not valid!"; } } else { //echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"1; URL=subscription.php\">"; //echo("$subscr"); } ?>
this is my code
presently i am using the regular expression of the website address but how do i use it to verify the rss feed address..
as the present one is validating the www.google.com also as a valid feed..
•
•
Join Date: Jan 2008
Posts: 146
Reputation:
Solved Threads: 20
0
#2 Nov 21st, 2009
Hey,
Could you not use cURL to read the response from the URL supplied, and then check that it starts with something like the following using regular expressions?
R
Could you not use cURL to read the response from the URL supplied, and then check that it starts with something like the following using regular expressions?
PHP Syntax (Toggle Plain Text)
<?xml version="1.0" encoding="utf-8"?> <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
R
Last edited by robothy; Nov 21st, 2009 at 2:50 pm.
•
•
Join Date: Jan 2008
Posts: 146
Reputation:
Solved Threads: 20
0
#4 Nov 22nd, 2009
Oh and by the way, if you want to do redirects within PHP, try using the Header method instead. E.g.
R.
PHP Syntax (Toggle Plain Text)
header('Location: target.html');
R.
•
•
Join Date: Jun 2009
Posts: 18
Reputation:
Solved Threads: 0
0
#5 Nov 23rd, 2009
i dont have curl installed in my php..Is there any way to do it without using curl.
•
•
Join Date: Feb 2010
Posts: 2
Reputation:
Solved Threads: 0
0
#6 28 Days Ago
Hey guys. I have this tiny bit problem stuck here. See, I have finished my RSS feed, tested it and all works perfectly, but when I remove an article from my feed it still showed in the reader. How do i get the reader to see the article is no longer part of the feed. Any ideas what's wrong?
<url snipped>
<url snipped>
Last edited by nav33n; 28 Days Ago at 7:18 am. Reason: Keep it on the site.
![]() |
Similar Threads
- RSS feed problem (RSS, Web Services and SOAP)
- Rss Feed (Java)
- RSS feed doesn't validate but why? (RSS, Web Services and SOAP)
- Having a hard time with an RSS feed (RSS, Web Services and SOAP)
- Displaying RSS feed on web site using rss2html.php (PHP)
- How do I put a blog RSS feed in PHPBB? (PHP)
- How to use this site's RSS feed? (DaniWeb Community Feedback)
- RSS Feed Readers (Geeks' Lounge)
- RSS Feed (Web Browsers)
Other Threads in the PHP Forum
- Previous Thread: Reading text file character by character
- Next Thread: onclick show images in table from form
Views: 925 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for rss, validator






