hi all can anyone point me in the right direction please.What id like to be able to do get access to the info from www.tfl.gov.uk/tfl/syndication/feeds/serviceboard-fullscreen.htm id like to be able to present in my own manner on a site.Can anyone tell me what i need to learn to be able to do it? Probably a huge question but any pointers appreciated. cheers
If you just want to display the information on that page you could do it with an iframe instead of using PHP. If you want to collect the data and display it in a different format, you'd need to open and then collect the contents of the page and display them in a new manner. Check out PHP.net entries for fopen and fread to open the page and check out explode and preg_match to collect the data.
Ideal code? No. Decent code? Yes. <?php define( 'PAGE', 'http://www.tfl.gov.uk/tfl/syndication/feeds/serviceboard-fullscreen.htm' ); /* Page URL */ define( 'STATIONS', 11 ); /* How many stations */ define( 'FIRST_LINE', 65 ); /* Normal form, first line = line 1, etc */ $page = explode( "\n", preg_replace( "/(\n)+/", "\n", str_replace( array("\t", "\r", '& '), '', strip_tags( file_get_contents( PAGE ) ) ) ) ); for ( $i = FIRST_LINE - 1, $end = FIRST_LINE - 1 + STATIONS * 2, $stations = array(); $i < $end; $i = $i + 2 ) $stations[$page[$i]] = $page[$i + 1]; print_r( $stations ); ?> PHP: Returns (obviously dependent on time): Array ( [Bakerloo] => Good service [Central] => Good service [Circle] => Good service [District] => Good service [H'smith City] => Good service [Jubilee] => Good service [Metropolitan] => Good service [Northern] => Good service [Piccadilly] => Good service [Victoria] => Good service [Waterloo City] => Planned closure ) Code (markup):
Thank you so much for taking the time to do that Danltn and also Seanblue. Very good of you and much appreciated. I now have a starting place and a good idea of what's needed. Thank you.