#!/usr/bin/php
"),array("","",""),$line);
}
if (strpos($line, "homerseklet")) {
$hom = str_replace(array("<","/","homerseklet>"),array("","",""),$line);
}
if (strpos($line, "relativlegnyomas")) {
$p = str_replace(array("<","/","relativlegnyomas>"),array("","",""),$line);
}
if (strpos($line, "legnedvesseg")) {
$rh = str_replace(array("<","/","legnedvesseg>"),array("","",""),$line);
}
if (strpos($line, "harmatpont")) {
$harmat = str_replace(array("<","/","harmatpont>"),array("","",""),$line);
}
if (strpos($line, "szelsebesseg")) {
$szelero = str_replace(array("<","/","szelsebesseg>"),array("","",""),$line);
}
if (strpos($line, "szelirany")) {
$szelirany = str_replace(array("<","/","szelirany>"),array("","",""),$line);
}
if (strpos($line, "szellokes")) {
$max_szelero = str_replace(array("<","/","szellokes>"),array("","",""),$line);
}
if (strpos($line, "csapadek1ora")) {
$csap1h = str_replace(array("<","/","csapadek1ora>"),array("","",""),$line);
}
if (strpos($line, "csapadek24ora")) {
$csap = str_replace(array("<","/","csapadek24ora>"),array("","",""),$line);
}
} //file vége
fclose($file); //weblap bezár
//----------- MetNet feltöltés indul
$metnet_user = "valami";
$metnet_pass = "akarmi";
$path = "/home/sajat_konytar/"; //pl: "C:\Program Files\EasyPHP-5.3.3\www\\"
# $szelero = $szelero*3.6;
# $max_szelero = $max_szelero*3.6;
//$datum = "$year-$mon-$mday $hour:$min:$sec";
$key = strtoupper(md5($metnet_user.strtoupper(md5($metnet_pass)).$datum));
$xml="
$metnet_user
$key
$datum
$hom
$p
$rh
$harmat
$szelero
$szelirany
$max_szelero
$csap1h
$csap
";
$xmlFile = $path."wsdata.xml";
$file = fopen($xmlFile, 'w') or die("File megnyitás hiba");
fwrite($file, $xml);
fclose($file);
# CURL POST:
$cfile = curl_file_create($path.'/wsdata.xml','','wsdata.xml'); // try adding
$xmldata = array('xmlfile' => $cfile);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://metnet.hu/code/api/obs_auto.php");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmldata);
$result=curl_exec ($ch);
curl_close ($ch);
// echo curl_error($ch);
echo $result;
//----------- MetNet feltöltés vége
/* MetNet további mezők
xxx
24DDB37xxxxxxxx5E372023FC3
2010-04-11 15:40:23UTC
18
1038
55
*/
}
?>