hello .. i'm trying to load remote xml file using php .. this is the function :
$doc = new DOMDocument();
$doc->load($this->xml_file);
$file = $doc->getElementsByTagName('file');
$totalFiles = $file->length;
echo $totalFiles;
and the remote xml file link is : http://localhost/script/index.php?act=xml
which this link generate xml output .. this is it's php code :
$xml = '<?xml version="1.0"?><MultimediaGallery>';
$query = mysql_query('SELECT `id`,`image`,`desc` FROM `'.confitem('database','prefix').'table` ORDER BY `id` DESC LIMIT '.$start.','.$limit);
while($result = mysql_fetch_array($query))
{
$img = unserialize($result['image']);
$desc = unserialize($result['desc']);
$xml .= '<file type="photo"><thumb>'.settings('site','url').'/'.OPATH_APPFOLDER.'/'.OPATH_UPFOLDER.'/wallpapers/thumbs/'.$img[0].'</thumb><source>'.settings('site','url').'/'.OPATH_APPFOLDER.'/'.OPATH_UPFOLDER.'/wallpapers/'.$img[0].'</source><description>'.$desc[$_SESSION['languagecode']].'</description></file>';
}
$xml .= '</MultimediaGallery>';
header("content-type: text/xml");
echo $xml;
so when i visit this xml file link direct in the browser .. it's output to me xml file with this style :
<?xml version="1.0"?><MultimediaGallery><file type="photo"><thumb>http://localhost/script/application/data/wallpapers/thumbs/1116205566_42ce0841ab_s.jpg</thumb><source>http://localhost/script/application/data/wallpapers/1116205566_42ce0841ab_s.jpg</source><description>dfdfdfdf</description></file></MultimediaGallery>
but when i visit the xml function which use dom to load the xml file , it's output this error message :
Warning: DOMDocument::load() [domdocument.load]: Extra content at the end of the document in http://localhost/script/index.php, line: 2 in C:\AppServ\www\script\application\libraries\wallpapers\multimedia.class.php on line 46
so please tell me actually what is the problem and what are steps to solve it ..
thanks alto ..