A continuación les comparto 2 scripts de PHP, los cuales sirven para adquirir el METAR/TAF y el NOTAM, ambos son reportes con información aeronáutica ( meteorología e información para el vuelo ).
METAR / TAF:
$oa = $argv[1];
if (empty($oa)) { $oa="SAEZ"; }
$file="ftp://tgftp.nws.noaa.gov/data/observations/metar/stations/".$oa.".TXT";
$homepage = "__METAR__";
$homepage .= "\n";
$homepage .= file_get_contents($file);
$homepage .= "\n";
$file="ftp://tgftp.nws.noaa.gov/data/forecasts/taf/stations/".$oa.".TXT";
$homepage .= "__TAF__";
$homepage .= "\n";
$homepage .= file_get_contents($file);
file_put_contents("[PATH]/script/metar.html",$homepage);
Notam ( actualización de Liberando código – NOTAM ):
$oa = $argv[1];
if (empty($oa)) { $oa="EZE"; }
print "NOTAM: ".$oa;
$ch = curl_init();
$data = 'indicador='.$oa;
curl_setopt($ch, CURLOPT_URL, 'http://ais.anac.gov.ar/notam/pib');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_REFERER, 'http://ais.anac.gov.ar/notam');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded','X-Requested-With: XMLHttpRequest'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $data );
$html = " \n";
$html .= " \n";
$html .= " \n";
$html .= curl_exec($ch);
$html .= " \n";
$html .= "";
file_put_contents( "[PATH]/script/notams/notam".$oa.".html",$html );