0

I have this line of code:

print_r($item->figure->iframe);

Which produces this output:

SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [height] => 288
            [mozallowfullscreen] => true
            [src] => http://www.hulu.com/embed.html?eid=Bq_uuy5X4KWFpYZgwa9e9g
            [allowfullscreen] => true
            [width] => 512
            [frameborder] => 0
            [scrolling] => 0
            [webkitAllowFullScreen] => true
        )

)

I then try this:

var_dump($item->figure->iframe->{'@attributes'}["src"]);

Which then gives me this:

NULL

What am I doing wrong? I want to get the src item, why can't I get it?

hakre
  • 193,403
  • 52
  • 435
  • 836
Get Off My Lawn
  • 34,175
  • 38
  • 176
  • 338
  • Using the class `SimpleXMLElement` without first reading the documentation is also wrong. – Jon May 07 '13 at 22:02
  • Also [***see here***](http://stackoverflow.com/questions/4327873/at-sign-in-simplexml-object) – phant0m May 07 '13 at 22:08

1 Answers1

0
var_dump($item->figure->iframe->attributes());

http://php.net/manual/en/simplexmlelement.attributes.php

Tasos Bitsios
  • 2,699
  • 1
  • 16
  • 22