Jakim najlepszym sposobem będzie wyciągniecie danych z XML a dokładnie z konkretnego wiersza??
Mój plik XML wygląda tak...
<?php require_once "../maincore.php"; if ($settings['hide_userprofiles'] && !iMEMBER) { redirect(BASEDIR."login.php"); } $result = dbquery("SELECT * FROM ".$db_prefix."lonsters WHERE lonsters_id='".$_GET['url']."' LIMIT 1"); } if (dbrows($result)) { $video_data = dbarray($result); } else { redirect("index.php"); } ?> $url = $linkers_data['lonsters_url']; echo "<xml version=\"1.0\" encoding=\"utf-8\">"; echo "<channel>"; echo "<link>http://www.youtube.com/v/$url</link>"; echo "</channel>"; echo "</xml>"; ?>
I przykładowo link do XML wygląda tak:
Adres: http://www.yousite.pl/movie/y.php?url=11
Zastosowałem do wyciągnięcia taką funkcje:
<?php $reader = new XMLReader(); $file = "http://www.yousite.pl/movie/y.php?url=11"; $reader->open($file); $count=0; while($reader->read()) { if($reader->nodeType == XMLReader::ELEMENT) { $name = $reader->name; if ($reader->name == 'link') { } } if($reader->nodeType == XMLReader::TEXT || $reader->nodeType == XMLReader::CDATA) { } if($reader->nodeType == XMLReader::END_ELEMENT) { if ($reader->name == 'link') { $count++; } } } ?>
Tylko nie chce aby mi wyświetlało całe drzewo lecz konkretny atrybut, w tym wypadku zawartość węzła <link>