Subversion Repositories Sites.obs-saisons.fr

Compare Revisions

Problem with comparison.

Ignore whitespace Rev HEAD → Rev 1

/obs_saisons/SPIP-v1-8-3/modules/maj_altitude.php
New file
0,0 → 1,43
<?php
 
 
// Programme de migration jetable
include_once 'connect.php';
//bouh! c'est pas propre! c'est a cause de PEAR et de ses includes
set_include_path('configuration/'.PATH_SEPARATOR.get_include_path());
//librairies PEAR
require_once 'configuration/DB.php' ;
$dsn='mysql://'.$login.':'.$pass.'@'.$hote.'/'.$db;
//echo $dsn.'<br /><br />';
$GLOBALS['car_db'] =& DB::connect($dsn) ;
if (DB::isError($GLOBALS['car_db'])) {
die ($GLOBALS['car_db']->getMessage());
}
 
$requete = 'SELECT STATION_ID, STATION_NOM, STATION_LATITUDE , STATION_LONGITUDE FROM STATION ';
 
$resultat = $GLOBALS['car_db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage());
}
 
$i=1;
 
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$alt = file_get_contents('http://ws.geonames.org/srtm3?lat='.$ligne['STATION_LATITUDE'].'&lng='.$ligne['STATION_LONGITUDE'], 'r') ;
 
$requete3= 'UPDATE STATION SET STATION_ALTITUDE='.$alt.' WHERE STATION_ID='.$ligne['STATION_ID'].';';
echo $requete3.'<br/>';
$i++;
// if ($i==10) exit;
}
?>