Hai
i am using the curl option to validate the site for the rss feed.
my code is

<?php
// create a new cURL resource
$ch = curl_init();
$demo='http://chaitu09986025424.blog.co.in/feed/rss/';
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://validator.w3.org/feed/check.cgi?url=$demo");
curl_setopt($ch, CURLOPT_HEADER, false);

// grab URL and pass it to the browser
curl_exec($ch);
echo $info['http_code'] . " " . $http_codes[$info['http_code']];
// close cURL resource, and free up system resources
curl_close($ch);
?>

now the problem is that how do i read the file and pass the parameters...
the result of this would be

Congratulations!
This is a valid RSS feed.

Recommendations
This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

•line 11, column 107: Self reference doesn't match document location [help]

... rel="self" type="application/rss+xml" /> ^Source: http://chaitu09986025424.blog.co.in/feed/rss/
1.<?xml version="1.0" encoding="UTF-8"?>
2.<rss version="2.0"
3.xmlns:content="http://purl.org/rss/1.0/modules/content/"
4.xmlns:wfw="http://wellformedweb.org/CommentAPI/"
5.xmlns:dc="http://purl.org/dc/elements/1.1/"
6.xmlns:atom="http://www.w3.org/2005/Atom"
7.>
8.
9.<channel>
10.<title>Chaitu's</title>
11.<atom:link href="http://chaitu09986025424.blog.co.in/wp-rss2.php" rel="self" type="application/rss+xml" />
12.<link>http://chaitu09986025424.blog.co.in</link>
13.<description>Know about the World and gain some Knowledge</description>
14.<pubDate>Fri, 20 Nov 2009 11:18:56 +0000</pubDate>

how do i pass the This is a valid RSS feed. data in code so that i can validate the given url..

please some body help me on this..

Recommended Answers

All 3 Replies

Try this:

<?php
// create a new cURL resource
$ch = curl_init();
$demo='http://chaitu09986025424.blog.co.in/feed/rss/';
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://validator.w3.org/feed/check.cgi?url=$demo");
curl_setopt($ch, CURLOPT_HEADER, false);

// grab URL and pass it to the browser
$data=curl_exec($ch);
echo $info['http_code'] . " " . $http_codes[$info['http_code']];
// close cURL resource, and free up system resources
curl_close($ch);

//$data
//contains the result
?>

hai
i have tried this one but still i am not getting any information..
The same info which i am getting using the curl_exec($ch);
there is no result getting displayed using the

echo $info['http_code'] . " " . $http_codes[$info['http_code']];

Didn't realize you were trying to get those two variables to work but the data from the result is stored in the $data variable and should be possible to use the preg_match_all function to find the appropriate section of data.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.