Retrieving a remote page with file_get_contents() : file_get_contents « File Directory « PHP






Retrieving a remote page with file_get_contents()

 
<?
$zip = 98052;

$weather_page = file_get_contents('http://www.demo.com/z.php?inputstring=' . $zip);

$page = strstr($weather_page,'Detailed Forecast');

$table_start = strpos($page, '<table');

$table_end  = strpos($page, '</table>') + 8;

print substr($page, $table_start, $table_end - $table_start);
?>
  
  








Related examples in the same category

1.Check net speed by loading a file
2.Checking for an error from file_get_contents()
3.Fetching a URL with file_get_contents()
4.Reading a file into a string
5.file_get_contents.php
6.file_put_contents( ) writes to a file with the equivalent of fopen( ), fwrite( ), and fclose( ) all in one function, just like file_get_contents( ).
7.Use file_get_contents with a URL
8.Retrieving a protected page