I have an rss in xml form with who contain (well formatted)
$xml = simplexml_load_file("/rss.xml");
echo $xml->item[0]->guid;
This code give me nothing.
If I var_dump
the $xml
, I get 40 array.
Can someone guess why?
edit:
Well... is a NSFW commision so care.. RSS file -> http://www.xvideos.com/rss/rss.xml (view-source:http://www.xvideos.com/rss/rss.xml for chrome)
var_dump:
object(SimpleXMLElement)#1 (2) {
["@attributes"]=>
array(1) {
["version"]=>
string(3) "2.0"
}
["channel"]=>
object(SimpleXMLElement)#2 (6) {
["title"]=>
string(11) "Xvideos.com"
["link"]=>
string(23) "http://www.xvideos.com/"
["description"]=>
string(43) "Xvideos, free hosting for free porn videos."
["lastBuildDate"]=>
string(31) "Mon, 18 Nov 2013 05:03:00 +0100"
["ttl"]=>
string(2) "20"
["item"]=>
array(40) {
[0]=>
object(SimpleXMLElement)#3 (5) {
["title"]=>
string(23) "..."
["description"]=>
string(766) ".. "
["link"]=>
string(59) "http://www.xvideos.com/..."
["guid"]=>
string(12) "video5748963"
["pubDate"]=>
object(SimpleXMLElement)#43 (0) {
}
}
[1]=>
object(SimpleXMLElement)#4 (5) {
["title"]=>
string(48) "...s"
["description"]=>
string(789) "..."
["link"]=>
string(84) "http://www.xvideos.com/,,,"
["guid"]=>
string(12) "video4863479"
["pubDate"]=>
object(SimpleXMLElement)#43 (0) {
}
}
....
var_dump
, youritem
is not a direct child of$xml
.echo $xml->channel->item[0]->guid;
. – Rocket Hazmat Nov 18 at 16:42