manmad Posted October 4, 2010 Share Posted October 4, 2010 im trying to make this kind of a page from this xml link from tvrage. can anyone help? i am newbie and sorry for bad english. xml link http://services.tvrage.com/feeds/fullschedule.php?country=US this is coding for countdown all tv shows. so this may help to make my thing <?php // Open Header, include functions and get the showid and cached xml include 'functions.php'; loadheader(); $loc = $_GET['loc']; $cache_time = 3600*24; // 24 hours $cache_file = './cache/countdown.xml'; $timedif = @(time() - filemtime($cache_file)); if (file_exists($cache_file) && $timedif < $cache_time) { $string = file_get_contents($cache_file); } else { $string = file_get_contents('http://services.tvrage.com/feeds/countdown.php'); if (($string) && ($f = @fopen($cache_file, 'w'))) { fwrite ($f, $string, strlen($string)); fclose($f); } } // Cached the file, now lets use it. if (!file_exists($cache_file)) { // Does it exist? If it doesn't there's a problem so lets report it. echo "<center><h2>Cache file issue: Cannot open cached XML poss connection issue?</h2></center>"; break; } $xml = simplexml_load_file($cache_file); echo "<div class=\"showtitle\">Current Countdown List for ".$loc."</div>\n"; echo "<table border=0 width=600px; cellpadding=2>\n"; echo "<tr><th width=30px;>Show:</th><th width=70px;>Episode:</th><th width=80px;>Season<br>Ep#</th><th width=80px;>Air Date</th><th>Relative Time: (From Cache File Creation)</th></tr>\n"; echo "<tr></tr>\n"; foreach($xml->country as $country){ echo "<tr><th colspan=\"5\"><b>Country List of: ".$country['name']."</b></th></tr>\n"; foreach($country->show as $node){ echo "<tr><td><a href=eplist.php?sid=".$node->showid.">".$node->showname."</a></td>\n"; echo "<td><a href=\"".$node->upcomingep->link."\">".make_safe($node->upcomingep->title)."</a></td>\n"; echo "<td>".$node->upcomingep->epnum."</td>\n"; echo "<td>".$node->upcomingep->airdate."</td>\n"; echo "<td>".$node->upcomingep->relativedate."</td></tr>\n"; } }echo "</table>\n"; echo "<p><div align=center>Page generated using a cached feed generated on: ".date ("F d Y H:i:s.", filemtime($cache_file))."</div></p>\n"; loadfooter(); ?> i got that script from here http://sourceforge.net/projects/tvrageshellsite/ Quote Link to comment https://forums.phpfreaks.com/topic/215167-getting-xml-from-t-v-rage-site/ Share on other sites More sharing options...
sKunKbad Posted October 5, 2010 Share Posted October 5, 2010 You should look for tutorials on simpleXML. There is nothing hard about doing what you want to do, and I can help you, but I'd feel bad about writing code for you without you trying. Maybe somebody else will write code for you, but unless you learn some php, then you'd expect people to always be writing your code/ simpleXML is REALLY simple, so give it a shot. Quote Link to comment https://forums.phpfreaks.com/topic/215167-getting-xml-from-t-v-rage-site/#findComment-1119153 Share on other sites More sharing options...
gizmola Posted October 5, 2010 Share Posted October 5, 2010 You should look for tutorials on simpleXML. There is nothing hard about doing what you want to do, and I can help you, but I'd feel bad about writing code for you without you trying. Maybe somebody else will write code for you, but unless you learn some php, then you'd expect people to always be writing your code/ simpleXML is REALLY simple, so give it a shot. Kudos to you sKunKbad! This has always been the attitude of the mods and admins here -- we're here to teach people to fish. There are a lot of people who write PHP code on a professional or at least semi professional basis, and nothing bugs me more than when people wade into a question like that and start re-writing a script that a poster didn't write, and doesn't understand. That type of poster doesn't contribute anything to the community, and won't be around once they get what they wanted. Sometimes the people who answer those questions, do so just to challenge themselves, and I understand when it happens, but I personally try and take your position as often as possible. You usually find out fairly quickly if the poster is actually come here to learn php or just to try and get suckers to write code for them for free. There's nothing wrong with writing free code, but I think those people would be better served wading into a decent open source project. Quote Link to comment https://forums.phpfreaks.com/topic/215167-getting-xml-from-t-v-rage-site/#findComment-1119160 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.