Youtube SimpleXMLElement prob! Em - PullRequest
       19

Youtube SimpleXMLElement prob! Em

0 голосов
/ 26 августа 2011

я что-то делаю с php для youtube, но xml-файл, который появляется в разделе с картинками пользователя, не отображается в выводе.

код:

$feedURL = 'http://gdata.youtube.com/feeds/api/users/davidguetta';
$sxml = simplexml_load_file($feedURL);

вывод:

SimpleXMLElement Object
(
    [id] => http://gdata.youtube.com/feeds/api/users/davidguetta
    [published] => 2006-07-26T12:05:23.000-07:00
    [updated] => 2011-08-26T04:34:26.000-07:00
    [category] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [scheme] => http://schemas.google.com/g/2005#kind
                            [term] => http://gdata.youtube.com/schemas/2007#userProfile
                        )

                )

            [1] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [scheme] => http://gdata.youtube.com/schemas/2007/channeltypes.cat
                            [term] => Musician
                        )

                )

        )

    [title] => davidguetta Channel
    [link] => Array
        (
            [0] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [rel] => http://gdata.youtube.com/schemas/2007#user.vlog
                            [type] => application/atom+xml
                            [href] => http://gdata.youtube.com/feeds/api/playlists/18F8D522B6C5D32C
                        )

                )

            [1] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [rel] => related
                            [type] => text/html
                            [href] => http://www.davidguetta.com
                        )

                )

            [2] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [rel] => alternate
                            [type] => text/html
                            [href] => http://www.youtube.com/profile?user=davidguetta
                        )

                )

            [3] => SimpleXMLElement Object
                (
                    [@attributes] => Array
                        (
                            [rel] => self
                            [type] => application/atom+xml
                            [href] => http://gdata.youtube.com/feeds/api/users/davidguetta
                        )

                )

        )

    [author] => SimpleXMLElement Object
        (
            [name] => davidguetta
            [uri] => http://gdata.youtube.com/feeds/api/users/davidguetta
        )

)

почему не выводится следующее?

<media:thumbnail url='http://i2.ytimg.com/i/uYZ-sFza5K_3GF0LyQAxjg/1.jpg'/>

1 Ответ

0 голосов
/ 26 августа 2011

Похоже, что SimpleXMLElement запутывается в именах тегов ':'.Вам, вероятно, следует использовать API данных PHP YouTube .

...