Indigo Rose Software
  #1  
Old 10-09-2004
Intrigued's Avatar
Intrigued Intrigued is offline
Indigo Rose Customer
 
Join Date: Dec 2003
Location: Location! Location!
Posts: 6,058
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);

?>
If someone has a different way of doing such in PHP 5 (or that works in PHP 5) then by all means please share! This is starting to get fun!

Note: I am very new to PHP in general, so don't pistol whip me to bad...
__________________
Intrigued
www.amsuser.com
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


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.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software