Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as PHP by Adnan ( 14 years ago )
<?php
$xml = simplexml_load_file('http://www.google.com/ig/api?weather=new-york');
$information = $xml->xpath("/xml_api_reply/weather/forecast_information");
$current = $xml->xpath("/xml_api_reply/weather/current_conditions");
$forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions");
/*changing default image of current weather */
$iconData = str_replace("/ig/images/weather/", "images/weather/", $current[0]->icon['data']);
$iconData = str_replace(".gif", ".png", $iconData);
?>
<h1>New-York City Weather</h1>
<div class="weather">
<img >icon['data']?>" alt="weather" />
<div class="condition"><strong>Today</strong><br />
<?php echo $current[0]->temp_f['data'] ?>° F,<?php echo $iconData ?>
</div>
</div>
<?php foreach ($forecast_list as $forecast) {
/*changing default images of forecast */
$iconData2 = str_replace("/ig/images/weather/", "images/weather/", $forecast->icon['data']);
$iconData2 = str_replace(".gif", ".png", $iconData2);
?>
<div class="weather">
<img src="<?php echo 'http://www.google.com' . $iconData2 ?>" alt="weather" />
<div class="condition">
<strong><?php echo $forecast->day_of_week['data']; ?></strong><br />
<?php echo $forecast->low['data'] ?>° F - <?php echo $forecast->high['data'] ?>° F,
<?php echo $forecast->condition['data'] ?>
</div>
</div>
<?php } ?>
Revise this Paste
Parent: 43174
Children: 43179