Results 1 to 5 of 5
  1. #1

    HELP-RSS News feed doesn't work

    I can't get my RSS News Feed to work. It was working at one time. Can someone please help. Here's the code from my site:

    <tr vAlign="top">
    <td bgColor="#f1f1f1" width="25"> </td>
    <td bgColor="#f1f1f1" colspan="3" height="100%"><!-- RSS FEED HERE -->

    <marquee id="scroller" onmouseover="this.stop();" onmouseout="this.start();" scrollamount=1 direction=up width="100%" height="95%">
    <?php

    $insideitem = false;
    $tag = "";
    $title = "";
    $description = "";
    $link = "";

    function startElement($parser, $name, $attrs) {
    global $insideitem, $tag, $title, $description, $link;
    if ($insideitem) {
    $tag = $name;
    } elseif ($name == "ITEM") {
    $insideitem = true;
    }
    }

    function endElement($parser, $name) {
    global $insideitem, $tag, $title, $description, $link;
    if ($name == "ITEM") {
    printf("<div class='content'><a href='%s' class='news_link' target='news'>%s</a></div><br>",
    trim($link),htmlspecialchars(trim($title)));

    $title = "";
    $description = "";
    $link = "";
    $insideitem = false;
    }
    }

    function characterData($parser, $data) {
    global $insideitem, $tag, $title, $description, $link;
    if ($insideitem) {
    switch ($tag) {
    case "TITLE":
    $title .= $data;
    break;
    case "DESCRIPTION":
    $description .= $data;
    break;
    case "LINK":
    $link .= $data;
    break;
    }
    }
    }

    $xml_parser = xml_parser_create();
    xml_set_element_handler($xml_parser, "startElement", "endElement");
    xml_set_character_data_handler($xml_parser, "characterData");
    $fp = fopen("http://www.securityfocus.com/rss/news.xml","r")
    or die("Error reading RSS data.");
    while ($data = fread($fp, 4096))
    xml_parse($xml_parser, $data, feof($fp))
    or die(sprintf("XML error: %s at line %d",
    xml_error_string(xml_get_error_code($xml_parser)),
    xml_get_current_line_number($xml_parser)));
    fclose($fp);
    xml_parser_free($xml_parser);

    ?>
    </marquee>
    </td>
    </tr>
    <tr valign="middle">
    <td bgColor="#f1f1f1" width="10"> </td>
    <td bgcolor="#f1f1f1" width="100%" valign="middle" align="right" colspan="3">
    <div class="news_source">News From SecurityFocus.com</div>
    <!-- <div class="more_links">more &gt;&gt;&gt;</div> -->
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    <!-- END TABLE FOR THE CONTENT -->
    <br>

  2. #2
    Join Date
    Dec 2002
    Location
    Egypt
    Posts
    151
    Is it reporting "Error reading RSS data." ?

    If so , check your host , it might be blocking 'fopen' call.
    knowledge is Power , Spread it.
    www.e-tutankhamun.com
    [email protected]
    AIM:AhmedFouad0 , yahooID:xor2004

  3. #3
    Yep its giving me that error.

  4. #4
    This is the error I get.



    Warning: fopen(): URL file-access is disabled in the server configuration in /home/.maestro/esec/esecuretechnologies.com/index2.php on line 146

    Warning: fopen(http://www.securityfocus.com/rss/news.xml): failed to open stream: no suitable wrapper could be found

  5. #5
    Join Date
    Dec 2002
    Location
    Egypt
    Posts
    151
    So it's your host blocking it , you need to contact them towards this problem to get it enabled again in php.ini
    knowledge is Power , Spread it.
    www.e-tutankhamun.com
    [email protected]
    AIM:AhmedFouad0 , yahooID:xor2004

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •