Nu sunt informatii'; return; } else { $oras = ucwords(str_replace('-', ' ', $_GET['oras'])); $q = array_search($oras, $statii); } # $file_name = "http://www.wunderground.com/auto/rss_full/global/stations/".$q.".xml"; # $file_name = "http://rss.wunderground.com/auto/rss_full/global/stations/".$q.".xml?units=metric"; $file_name = "http://romanian.wunderground.com/auto/rss_full/global/stations/".$q.".xml?units=metric"; # $file_name = $q.".xml"; #echo $file_name; /* ## Varianta cu functii curl - START ob_start(); $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $file_name); curl_exec ($ch); curl_close ($ch); $str = ob_get_contents(); ob_clean(); ob_end_flush(); $file_array = explode("\n",$str); ## Varianta cu functii curl - END */ ## Varianta cu functia file - START $file_array = @file($file_name); if ( !($file_array) ) { echo 'Nu sunt informatii pentru "'.$oras.'"'; return; } ## Varianta cu functia file - END #echo '
';

    foreach ($file_array as $buffer) {
        if ( eregi('(.*)', $buffer, $out) ) {
            $last_build_date_array = explode(' ', $out[1]);
        }
    }
    $last_build_date = $last_build_date_array[1].'-'.$last_build_date_array[2].'-'.$last_build_date_array[3];
    $last_build_time = substr($last_build_date_array[4], 0, -3);
#echo $last_build_date."\n";
#echo $last_build_time."\n";


    $str_to_be_replaced_array = array("", "", "ă", "â", "", "ţ", "ş", "î", "\r", "\n", "\t");
    $str_to_replace_array     = array("a", "a",  "a",  "a", "t",  "t",  "s",  "i",   "",   "",   "");
    
    $compas_to_be_replaced_array = array("North", "South", "East", "West", "Variable");
    $compas_to_replace_array     = array("Nord", "Sud", "Est", "Vest", "Variabila");

    $input_record_structure = array (
        array('title', '/.*/'),
#        array('link', '/.*/'),
        array('description', '/.*/'),
#        array('pubDate', '/.*/'),
#        array('guid', '/.*/')
    );
    $input_field_delimiter = '';
    $input_field_quote_character = '';

    $doc = new DOMDocument();
    $doc->load($file_name);

    $x = $doc->getElementsByTagName('item');

    $tmp_record_array = array();
    for ($i = 0; $i <= $x->length-1; $i++) {
        $tmp_record_string = '';
        foreach ($input_record_structure as $field_id => $field_desc) {
            list($field_name, $field_pattern) = $field_desc;

            $item_array[$field_name] = $x->item($i)->getElementsByTagName($field_name);
            $field_value = $item_array[$field_name]->item(0)->childNodes->item(0)->nodeValue;
            $tmp_record_string = str_replace($str_to_be_replaced_array, $str_to_replace_array, $field_value);

            if ($field_name == 'title' and $i > 0) {
                list($forecast_day_str, $for_date) = explode(" as of ", $tmp_record_string);
                $tmp_record_array[$i]['day'] = $forecast_day_str;
            }
            if ($field_name == 'description') {
                if ($i == 0) {
    #                $tmp_record_array[$i][] = $tmp_record_string;
                    $weather_status_array = explode(" | ", $tmp_record_string);
                    foreach($weather_status_array as $tmp_str) {
                        list($key, $value) = explode(': ', $tmp_str);
                        $key = trim($key);
                        $value = trim($value);
                        switch ($key) {
                            case 'Temperatura':
                                $tmp_value = str_replace('°', '°', $value);
                                break;
                            case 'Presiunea':
                                $tmp_value = str_replace('Presiunea ', '', $value);
                                break;
                            case 'Conditii':
                                $tmp_value = $conditii[$value];
                                if ($tmp_value == '') {
                                    $tmp_value =  $conditii['Unknown'];
                                    $send_unknown_condition = $value;
                                }
                                break;
                            case 'Directia vantului':
                                $tmp_value = str_replace($compas_to_be_replaced_array, $compas_to_replace_array, $value);
                                break;
                            case 'Viteza vantului':
                                list($tmp_value, $tmp_value_rest) = explode(''.$mail_to.'
'; echo 'Please follow the instructions in that email.

Thank you'; } else { echo 'The application tried to send you an email to the address: '.$mail_to.'
'; echo 'Unfortunatelly this operation did not succeed.

'; echo 'Please try again'; } */ } ?> Meteo <?= $oras ?>

Meteo

'."\n"; foreach($keys_array as $key) { echo ''."\n"; } echo ''."\n"; $tmp_record_array_len = sizeof($tmp_record_array); for ($i = 1; $i < $tmp_record_array_len; $i++) { echo ''."\n"; echo ''."\n"; } echo '
la ora
(Click pentru detalii)
'."\n"; echo '
Starea curenta

'. $key.':  '. $tmp_record_array[0][$key].'

Prognoza
'. $tmp_record_array[$i]['day']. ':
'. $tmp_record_array[$i]['temp'].' '.$tmp_record_array[$i][$tmp_record_array[$i]['temp']].' '.$tmp_record_array[$i]['forecast']. '
'."\n"; ?>
Alte informatii meteo