Created
August 23, 2012 13:39
-
-
Save necenzurat/3436686 to your computer and use it in GitHub Desktop.
accuweather
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$curl = file_get_content("http://www.accuweather.com/ro/ro/bucuresti/bucharest/hourly.aspx"); | |
/* Ora */ | |
preg_match_all("(<div class=\"hbhItem textBold\">(.*?)</div>)s", $curl, $out); | |
//$ora = strtolower(trim($out[1][0])); | |
/* Temperatura */ | |
$temperatura = trim($out[1][4]); | |
$temperatura = str_replace("°C", "", "$temperatura"); | |
/* RealFeel */ | |
$realfeel = trim($out[1][8]); | |
$realfeel = str_replace("°C", "", "$realfeel"); | |
/* Umiditate */ | |
$umiditate = trim($out[1][16]); | |
/* Starea vremii */ | |
preg_match_all("(<div class=\"hbhItem hbhWxText\">(.*?)</div>)s", $curl, $out); | |
$prognoza = strtolower(trim($out[1][0])); | |
$status = "La ora $ora:00 afara este: $prognoza. Temperatura: $temperatura grade C ($realfeel) si umiditatea este de $umiditate."; | |
echo "$status"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment