Hello everyone, I am trying to create a condition to check if a users blog feed is working based on the URI they submit. This is what I'm working with and when the URI is not a correct feed, I get this: Warning: xml_parse() [function.xml-parse]: Unable to call handler cdataHandler() in /options.php on line 46
How will I be able to check if a users URI is actually a real feed? Thank!PHP Code:$uri = "http://www.example.com";
if( $fp = @fopen($uri, "r"))
{
$parser = xml_parser_create();
xml_set_object($parser, $this);
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 1);
xml_set_character_data_handler($parser, "cdataHandler");
xml_set_element_handler($parser, "startElementHandler", "endElementHandler");
while($xml = fread($fp, 4096))
{
if(!xml_parse($parser, $xml, feof($fp)))
{
$error = "XML ERROR: " . xml_error_string( xml_get_error_code($parser)) . " at line " . xml_get_current_line_number($parser);
}
}
xml_parser_free($parser);
fclose($fp);
echo "a working feed!";
}
else
{
echo "not a working feed!";
}



Bookmarks