spellbinder Posted September 7, 2006 Share Posted September 7, 2006 Hi, I'm new here and i'm still reading the tutorials but it's a bit complicated for me..so i'm wondering if someone can check if my parsing is correct because i'm stuck in doing my assignments...thanks in advance<?php $URL="http://www.linuxsig.net/project/todayrss.php"; $file = fopen($URL, 'r'); if(!$file) die("Cannot open file."); include("dbconnect.php"); @mysql_query("DELETE FROM 'today'", $db); //read rss feed contents $readfile = fread($file, 1000); $searchfile = eregi("<item>(.*)</item>", $readfile, $array); //place articles in array $article = explode("<item>", $array[0]); $counter = count($article); echo "<table border='1'>"; echo "<th colspan='2'>MMU Lastest News</th>";//loop to display all bulletinsfor ($i=0; $i<count; $i++){ //fetch titles ereg("<title>(.*)</title>", $article[i], $title); //fetch categories ereg("<category>(.*)</category>", $article[i], $category); //fetch descriptions ereg("<description>(.*)</description>", $article[i], $description); //fetch links ereg("<link>(.*)</link>", $article[i], $link); echo "<tr><td>"; echo $title[1]; echo "</td><td>"; echo "<a href='$link[1]'\>$link[1]</a>"; echo "</td></tr>";} echo "</table>"?> Quote Link to comment Share on other sites More sharing options...
btherl Posted September 7, 2006 Share Posted September 7, 2006 I get a 404 error on that URL.Does your code work? I'm unclear on what your question is.It looks to me like your code will work, as long as there is only one title, category, description and link in each item.There is no need to set $searchfile = eregi(...) if you aren't going to reference that variable later though. You can just call eregi() the same way you call ereg() later in your code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.