<?php

$datearg   = gmdate("Y-m-d H:i:s");
$latitude  = 38.289139;
$longitude = -104.496500;
$altitude  = 24000;

$postfields = sprintf('<nwx version="0.3.5"><Request id="1"><Wind id="WPT" p="%s,%s" z="%s" u="A" e="%s"/> <AvailableLevels/> <terrain p="%s,%s"/> </Request></nwx>',$latitude,$longitude,$altitude,$datearg,$latitude,$longitude);


$url = "http://navlost.eu/nwxs/";

if ( function_exists( 'curl_init' ) ){
$ch = curl_init();
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, 5 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $postfields );
$content = curl_exec( $ch );
curl_close( $ch );
}else{
 die( 'No method to read from remote server was found (i.e., curl).' );
}


printf("<pre>%s\n",$content);
//$navary = xml2array($content);

//$wdir = $navary["nwx"]["Response"]["Wind"]["dir"];
//$wkts = $navary["nwx"]["Response"]["Wind"]["speed"];
//$elev = $navary["nwx"]["Response"]["terrain"];




?>