<?php
$ip = $_SERVER['REMOTE_ADDR'];
$url = 'http://api.sypexgeo.net/xml/'. $ip .'';
$xml = simplexml_load_string(file_get_contents($url));
$loc_array = array($xml->ip->city->lat,$xml->ip->city->lon);
$loc_safe = array();
foreach($loc_array as $loc){
$loc_safe[] = urlencode($loc);
}
$loc_string=implode(',', $loc_safe);
$json = file_get_contents('http://api.wunderground.com/api/****/satellite/webcams/forecast/q/' . $loc_string . '.json');
$obj = json_decode($json, true);
?>
<?
$html .= "</h2><table cellpadding=4 cellspacing=3><tr>";
foreach ($obj['forecast']['simpleforecast']['forecastday'] as $arr) {
$html .= "<td align='center'>" . $arr['date']['weekday'] . "<br />";
$html .= "<img src='http://icons-pe.wxug.com/i/c/k/" . $arr['icon'] . ".gif' border=0 /><br />";
$html .= "<font color='red'>" . $arr['high']['celsius'] . '°C' . " </font>";
$html .= "<font color='blue'>" . $arr['low']['celsius'] . '°C' . "</font>";
$html .= "</td>";
}
$html .= "</tr></table>";
echo $html;
?>
<script type="text/javascript">
window.onload=function(){
//пробовал так, не меняет, а вот в фидлере меняет
$("td:contains('Tuesday')").html("Вторник");
};
</script>
$json = file_get_contents('http://api.wunderground.com/api/****/satellite/webcams/forecast/q/' . $loc_string . '.json');
$obj = json_decode($json, true);
$json = file_get_contents('http://api.wunderground.com/api/****/satellite/webcams/forecast/q/' . $loc_string . '.json');
$json = str_replace('Monday', 'Понедельник', $json);
$json = str_replace('Tuesday', 'Вторник', $json);
$json = str_replace('Wednesday', 'Среда', $json);
$json = str_replace('Thursday', 'Четверг', $json);
$json = str_replace('Friday', 'Пятница', $json);
$json = str_replace('Saturday', 'Суббота', $json);
$json = str_replace('Sunday', 'Воскресенье', $json);
$obj = json_decode($json, true);