Jump to content

getting xml from T V Rage site


manmad

Recommended Posts

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.

 

c9c09748.jpg

 

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/

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.