
June 29th, 2003, 01:27 PM
|
|
Contributing User
|
|
Join Date: Apr 2003
Location: US
Posts: 261
Time spent in forums: 1 h 54 m 29 sec
Reputation Power: 6
|
|
um... I'm sorry, I'm really new to XML. I created the script from PHP, but am parsing it using XML. I don't know what you mean by that. Could you please tell me what to do? Here's the code:
PHP Code:
<?php
include("functions.php");
echo "<style>
body { font-family: Verdana; font-size: 10pt }
table { font-family: Verdana; font-size: 10pt }
</style>";
if(!$submit) {
echo "<form method=\"POST\" action=\"$PHP_SELF\">
<p align=\"center\">Your Zip Code: <input type=\"text\" name=\"zipcode\">
<input type=\"submit\" value=\"Get Weather >>\" name=\"submit\"></p>
</form>";
} else if($submit && empty($zipcode)) {
echo "<center>Please enter a zipcode, thanks!</center>";
} else if($submit && !empty($zipcode)) {
$grab = "http://ejse.com/WeatherService/Service.asmx/GetExtendedWeatherInfo?zipcode=$zipcode";
$fp = fopen($grab, "rb");
$contents = fread($fp, 9999999);
fclose($fp);
$location = untag($contents, "Location");
$forecast = untag($contents, "Forecast");
$temperature = untag($contents, "Temprature");
$feelslike = untag($contents, "FeelsLike");
$visibility = untag($contents, "Visibility");
$pressure = untag($contents, "Pressure");
$dewpoint = untag($contents, "DewPoint");
$uvindex = untag($contents, "UVIndex");
$humidity = untag($contents, "Humidity");
$wind = untag($contents, "Wind");
$reported = untag($contents, "ReportedAt");
$updated = untag($contents, "LastUpdated");
$icon = untag($contents, "IconIndex");
echo "<h1 align=\"center\">View Your Weather</h1>
<table><tr><td><p align=\"center\"><img src=\"icons/".$icon[0].".gif\"></td><td>
<p align=\"center\"><font size=\"5\"><b>".$temperature[0]."</b></font></td>
</tr><tr><td><p align=\"center\"><b><span style=\"font-size: 9pt\">".$forecast[0]."</span></b></td>
<td><p align=\"center\"><b><span style=\"font-size: 9pt\">Feels Like ".$feelslike[0]."</span></b></td>
</tr></table><br><table><tr><td>UV Index:</td><td>".$uvindex[0]."</td>
</tr><tr><td>Dew Point:</td><td>".$dewpoint[0]."</td></tr><tr>
<td>Humidity:</td><td>".$humidity[0]."</td></tr><tr> <td>Visibility:</td><td>".$visibility[0]."</td>
</tr><tr><td>Pressure:</td><td>".$pressure[0]."</td></tr><tr><td>Wind:</td> <td>".$wind[0]."</td></tr></table><p>As reported at: ".$reported[0]."<br>Last updated: ".$updated[0]."</p>";
}
?>
Thanks a lot for your help!!
|