reading Rss Feed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    #1

    reading Rss Feed

    hi i am trying to display videos from an rss feed , every thing was working fine then atonce every thing stopped working and i started receiving error
    [code=error]
    Warning: DOMDocument::lo ad() [domdocument.loa d]: Start tag expected, '<' not found in http://www.paksiasat.c om/feed/, line: 1 in M:\xamp2\xampp\ htdocs\entertai nment\home.php on line 6
    [/code]


    my code is as follows
    [code=php]
    $doc = new DOMDocument();
    //$doc_thumb = new DOMDocument();
    $doc->load("http://www.paksiasat.c om/feed/");

    //$doc_thumb->load("http://www.paksiasat.c om/feed/");
    ?> <!-- content -->

    <div class="subfeatu res">
    <div class="subfeatu res-inner">
    <ul>
    <?php
    foreach($doc->getElementsByT agName('item') as $node){
    $rss = array (
    'title' => $node->getElementsByT agName('title')->item($counte r)->nodeValue,
    'description' => $node->getElementsByT agName('descrip tion')->item($counte r)->nodeValue,
    'link' => $node->getElementsByT agName('link')->item($counte r)->nodeValue,
    'date' => $node->getElementsByT agName('pubDate ')->item($counte r)->nodeValue,
    'comments' => $node->getElementsByT agName('comment s')->item($counte r)->nodeValue,
    'content' => $node->getElementsByT agName('encoded ')->item($counte r)->nodeValue,
    'guid' => $node->getElementsByT agName('guid')->item($counte r)->nodeValue
    );

    echo '
    <li class="subfeatu re">
    <a href="'.$rss['guid'].'" title="'.$rss['title'].'" class="" style="">
    <img src="http://localhost:8080/wordpress/wp-content/themes/wave/thumb.php?src=/wp-content/themes/wave/images/placeholder-subfeature.jpg& amp;w=158&amp;h =116&amp;zc=1&a mp;q=95" alt="'.$rss['title'].'">
    <span>&nbsp;'.$ rss['title'].'</span>
    </a></li>
    ';
    }
    ?>
    </ul>
    </div>
    </div>
    [/code]
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I’m not entirely sure if ->load() supports loading from an URL. the Manual only mentions files from the filesystem (but does not explicitly exclude URLs). comment #3 indicates, that load() does not resolve DNS domain names.

    if you have allow_url_fopen enabled, you can fetch the XML via file_get_conten ts().

    Comment

    Working...