@jesster444 : Yes here my rapid solution :
<?php
// Resource Name: WeatherX
// Author: Jesse Rochman
// Forum Alias: jesster444
// Version: 1.0
// Compatible with .95Beta5
// Released: 11/1/2006
// Created from Nick Schaffner's WEATHER.COM XML PARSER
// Template Placeholders: wxIcon, wxSunr, wxSuns, wxWindSpeed, wxWindir, wxTemp, wxConditions, wxDate
//////// Some Constants
$wxUrl = 'http://xoap.weather.com/weather/local/'; // URL to xoap.weather
$wxUPDATE_CONSTANT = 100; //This is how often the weather will be updated. DON'T CHANGE!
$wxNow = time(); //This allows us to see if we need to update variables
//////// Set Varibles Below
$wxZipcode = 'FRXX0016'; // Zipcode Bordeaux, FR
$wxPartner = 'xxxxx'; // Partner ID
$wxLicense = 'xxxxxx'; // License Key
$wxIcons = 'assets/snippets/weatherx/graphics'; // Path to Weather Icons
$wxUnits = 'metric'; // Set to 'english' or 'metric' (Celsius & KMH)
$wxClock = 24; // Set to '12' or '24' hour format
$wxUpdateFile = $modx->config['base_path'] . 'assets/snippets/weatherx/weather.txt';
/////Read the file and establish all the output variables
$handle = fopen($wxUpdateFile, 'r');
$contents = fread($handle, filesize($wxUpdateFile));
fclose($handle);
$contents = explode('|', $contents);
$wxLastUpdate = $contents[0] + $wxUPDATE_CONSTANT;
$wxIcon = $contents[1];
$sunr = $contents[2];
$suns = $contents[3];
$date = $contents[4];
$s = $contents[5];
$conditions = $contents[6];
$tmp = $contents[7];
$windir = $contents[8];
$getXmlMethod = (isset($getXmlMethod))? $getXmlMethod : '';
/////Set all the placeholders so you can output the format in a template or chunk!
$modx->setPlaceholder('wxIcon', $wxIcon);
$modx->setPlaceholder('wxSunr', $sunr);
$modx->setPlaceholder('wxSuns', $suns);
$modx->setPlaceholder('wxDate', $date);
$modx->setPlaceholder('wxWindSpeed', $s);
$modx->setPlaceholder('wxConditions', $conditions);
$modx->setPlaceholder('wxTemp', $tmp);
$modx->setPlaceholder('wxWindDir', $windir);
//Check to see if we need to update the variables otherwise we are done.
if ($wxLastUpdate < $wxNow) {
//////// Parse XML
$file = $wxUrl . $wxZipcode . '?cc=*&&prod=xoap&par=' . $wxPartner. '&key=' . $wxLicense;
$xml_parser = xml_parser_create();
if (file_exists($file)){
$data = implode('', file($file));
} else {
if($getXmlMethod = 'curl'){
function get_xml($url, $parametres=array()) {
$params='';
if ($parametres['Referer']!="") $params.='-e '.$parametres['Referer'];
if ($parametres['Proxy']!="") $params.='-x '.$parametres['Proxy'];
if ($parametres['BrowserName']!="") $params.='-A "'.$parametres['BrowserName'].'"';
return (`curl $params $url`);
}
$data = get_xml($file);
}
else {
$fp = fopen($file,'r');
while(!feof($fp)){
$data = $data . fread($fp, 1024);
}
fclose($fp);
}
}
xml_parse_into_struct( $xml_parser, $data, $vals, $index );
xml_parser_free( $xml_parser );
$t = true;
foreach ($vals as $key => $i) {
if ($vals[$key]['value'] != false) {
if ($vals[$key]['tag'] != 'T') {
$temp = strtolower($vals[$key]['tag']);
$$temp = $vals[$key]['value'];
} elseif ($t == true) {
if ($vals[$key]['level'] == 3) $conditions = $vals[$key]['value'];
else { $windir = $vals[$key]['value']; $t = false; break; }
}
}
}
//////// Make sense of the varibles
$sunr = str_replace (' ','',$sunr);
$suns = str_replace (' ','',$suns);
$date = date('d/m/Y');
//$Ville= obst
if ($wxUnits == 'metric') { // Set Metric
$tmp = round((($tmp - 32)/9) * 5);
$flik = round((($flik - 32)/9) * 5);
$s = round($s * 1.609);
}
if ($wxClock == 24) {
$sunr = date('H:i',strtotime($sunr));
$suns = date('H:i',strtotime($suns));
}
if ($s == 'calm') $wind = 'Calm';
$wxIcon = $modx->config['base_url'] . $wxIcons . '/' . $icon . '.png';
$wxWrittenInfo = $wxNow . '|' . $wxIcon . '|' . $sunr . '|' .$suns . '|' . $date . '|' . $s . '|' . $conditions . '|' . $tmp . '|' . $windir;
// Let's make sure the file exists and is writable first.
if (is_writable($wxUpdateFile)) {
if (!$handle = fopen($wxUpdateFile, 'w')) {
exit;
}
// Write content to our opened file.
if (fwrite($handle, $wxWrittenInfo) === FALSE) {
exit;
}
fclose($handle);
}
}
?>
to use with :
[!WeatherX getXmlMethod=`curl`!]