|
#1
|
||||
|
||||
|
Weather data and PHP 5 . . .
Here is an example I read about in the PHP 5 book I am reading. I modified it slightly. Remember, this uses a absolute URL path... and may become unreliable at some point. So, make sure if you use it to check that web page often, or code it differently.
Code:
<?php
print "<H1>NAME OF CITY GOES HERE!</H1>"; // example: print "<H1>Redmond</H1>";
?>
<br/> <!-- break out of PHP to add this break -->
<?php
$zip = CHOOSE A ZIP CODE; // example: $zip = 98052;
$weather_page = file_get_contents('http://www.srh.noaa.gov/zipcity.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);
?>
![]() Note: I am very new to PHP in general, so don't pistol whip me to bad... |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Proxy Data | CWRIGHT | AutoPlay Media Studio 5.0 | 21 | 06-20-2008 05:27 AM |
| Function: Email Any Data Through PHP | Brett | AutoPlay Media Studio 5.0 Examples | 8 | 10-02-2004 09:08 PM |
| Getting data from an internet text file into AMS | User1 | AutoPlay Media Studio 4.0 | 3 | 07-13-2003 03:46 PM |
All times are GMT -6. The time now is 09:04 AM.









Linear Mode

