"Tormenta de llams", "Clear" => "Clar", "Today" => "Avui", "Tomorrow" => "Demà", "Mon" => "Dilluns", "Tue" => "Dimarts", "Wed" => "Dimecres", "Thu" => "Dijous", "Fri" => "Divendres", "Sat" => "Dissabte", "Sun" => "Diumenge", "Rain" => "Pluja", "Snow" => "Neu", "Showers" => "Xàfecs", " of " => " de ", "High" => "Màx", "Low" => "Min", "Partly" => "Parcialment", "Cloudy" => "Nubolat", "5 Day Forecast" => "Previsió dels pròxims 5 dies.", "Mostly" => "Majoritàriament", "Light" => "Una mica de", "17%" => "12%", "16%" => "12%", "Feels Like" => "  Temp aparent", "Barometer" => "  Boròmetre", "Humidity" => "  Humitat", "Visibility" => "  Visibilitat", "Dewpoint" => "T.Condensació", "Sunrise" => "Sortida", "Sunset" => "Posta", "Wind" => "Vent", "Sunny" => "Assoleiat", "Scattered" => "Escampat", "Scattered Snow Showers" => "Xàfecs escampats de neu", "" => "", "
" => "", "Algunos" => "Alguns", "Chubascos" => "Xàfecs", "chubascos" => "xàfecs", "nieve" => "neu", "Lluvia" => "Pluja", "Tiempo" => "Temps", "Previsto" => "Previst", "Temperatura" => "Temperatura", "Sensación Térmica" => "Sensació Tèrmica", "Punto del rocío" => "Temp de condensació", "Humedad" => "Humitat", "Viento" => "Vent", "Posibilidad de precipitación" => "Possibilitat de precipitació", "Nordeste" => "Nordest", "Este" => "Est", "Sur" => "Sud", "del Oeste" => "de l'Oest", "nuboso" => "núvol", "Parcialmente" => "Parcialment", "Muy " => "Molt ", "Nubosidad " => "Núvols ", "abundante" => "abundants", "lun" => "Dilluns", "mar" => "Dimarts", "mie" => "Dimecres", "jue" => "Dijous", "vie" => "Divendres", "sab" => "Dissabte", "dom" => "Diumenge", "Soleado" => "Assoleiat", "Despejado" => "Destapat", "débil" => "dèbil", "Day" => "Dies", "Wetterzustand" => "Temps", "Temperatur" => "Temp.", "Niederschlag" => "Humitat", "Windrichtung" => "Direcció", "Morgens" => "Matí", "Mittags" => "Mig Dia", "Abends" => "Nit", "Montag" => "Dilluns", "Dienstag" => "Dimarts", "Mittwoch" => "Dimecres", "Donnerstag" => "Dijous", "Freitag" => "Divendres", "Samstag" => "Dissabte", "Sontag" => "Diumenge", "Ost" => "Est", "Süd" => "Sud", "West" => "Oest" */ ); // +++++++++++++++++++++++++++++++++++++++ $be = new BrowserEmulator(); $be->addHeaderLine("Referer", "http://www.whether.com"); $be->addHeaderLine("Accept-Encoding", "x-compress; x-zip"); // $be->addPostData("username", "postmaster"); // $be->addPostData("domain", $domini); // $be->addPostData("password", $passacces); $file = $be->fopen("http://www.wetter.com/mobile/wetter.php?id=" . $id . "&type=WORLD"); /* $response = $be->getLastResponseHeaders(); echo join($response,"
"); */ $final = ""; $temps = array(); $comprova = true; $condicio1 = false; $condicio2 = false; $condicio3 = false; $liniaanteriorbona = false; while ($comprova && ($line = fgets($file, 1024))) { // echo htmlentities($line); // echo "
"; if (eregi("Vorhersage",$line)) { $condicio1 = true; } if($condicio1) { if($condicio2) { if (eregi("",$line)) { $condicio3 = false; $comprova = false; // para l'analisis } } //condicio 3 }// condicio 2 if (eregi("
<? echo $titol;?>
resetHeaderLines(); $this->resetPort(); } /** * Adds a single header field to the HTTP request header. The resulting header * line will have the format * $name: $value\n **/ function addHeaderLine($name, $value) { $this->headerLines[$name] = $value; } /** * Deletes all custom header lines. This will not remove the User-Agent header field, * which is necessary for correct operation. **/ function resetHeaderLines() { $this->headerLines = Array(); /*******************************************************************************/ /************** YOU MAX SET THE USER AGENT STRING HERE *******************/ /* */ /* default is "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", */ /* which means Internet Explorer 6.0 on WinXP */ $this->headerLines["User-Agent"] = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; /*******************************************************************************/ } /** * Add a post parameter. Post parameters are sent in the body of an HTTP POST request. **/ function addPostData($name, $value) { $this->postData[$name] = $value; } /** * Deletes all custom post parameters. **/ function resetPostData() { $this->postData = Array(); } /** * Sets an auth user and password to use for the request. * Set both as empty strings to disable authentication. **/ function setAuth($user, $pass) { $this->authUser = $user; $this->authPass = $pass; } /** * Selects a custom port to use for the request. **/ function setPort($portNumber) { $this->port = $portNumber; } /** * Resets the port used for request to the HTTP default (80). **/ function resetPort() { $this->port = 80; } /** * Make an fopen call to $url with the parameters set by previous member * method calls. Send all set headers, post data and user authentication data. * Returns a file handle on success, or false on failure. **/ function fopen($url) { $this->lastResponse = Array(); preg_match("~([a-z]*://)?([^:^/]*)(:([0-9]{1,5}))?(/.*)?~i", $url, $matches); $protocol = $matches[1]; $server = $matches[2]; $port = $matches[4]; $path = $matches[5]; if ($port!="") { $this->setPort($port); } if ($path=="") $path = "/"; $socket = false; $socket = fsockopen($server, $this->port); if ($socket) { $this->headerLines["Host"] = $server; if ($this->authUser!="" && $this->authPass!="") { $this->headerLines["Authorization"] = "Basic ".base64_encode($this->authUser.":".$this->authPass); } if (count($this->postData)==0) { $request = "GET $path HTTP/1.0\r\n"; } else { $request = "POST $path HTTP/1.0\r\n"; } if ($this->debug) echo $request; fputs ($socket, $request); if (count($this->postData)>0) { $PostStringArray = Array(); foreach ($this->postData AS $key=>$value) { $PostStringArray[] = "$key=$value"; } $PostString = join("&", $PostStringArray); $this->headerLines["Content-Length"] = strlen($PostString); } foreach ($this->headerLines AS $key=>$value) { if ($this->debug) echo "$key: $value\n"; fputs($socket, "$key: $value\r\n"); } if ($this->debug) echo "\n"; fputs($socket, "\r\n"); if (count($this->postData)>0) { if ($this->debug) echo "$PostString"; fputs($socket, $PostString."\r\n"); } } if ($this->debug) echo "\n"; if ($socket) { $line = fgets($socket, 1000); if ($this->debug) echo $line; $this->lastResponse[] = $line; $status = substr($line,9,3); while (trim($line = fgets($socket, 1000)) != ""){ if ($this->debug) echo "$line"; $this->lastResponse[] = $line; if ($status=="401" AND strpos($line,"WWW-Authenticate: Basic realm=\"")===0) { fclose($socket); return FALSE; } } } return $socket; } /** * Make an file call to $url with the parameters set by previous member * method calls. Send all set headers, post data and user authentication data. * Returns the requested file as an array on success, or false on failure. **/ function file($url) { $file = Array(); $socket = $this->fopen($url); if ($socket) { $file = Array(); while (!feof($socket)) { $file[] = fgets($socket, 10000); } } else { return FALSE; } return $file; } function getLastResponseHeaders() { return $this->lastResponse; } } ?>