Skip to content

Instantly share code, notes, and snippets.

@necenzurat
Created August 23, 2012 13:39
Show Gist options
  • Save necenzurat/3436686 to your computer and use it in GitHub Desktop.
Save necenzurat/3436686 to your computer and use it in GitHub Desktop.
accuweather
<?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("&deg;C", "", "$temperatura");
/* RealFeel */
$realfeel = trim($out[1][8]);
$realfeel = str_replace("&deg;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