Subversion Repositories Sites.obs-saisons.fr

Rev

Rev 5 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 aurelien 1
<?php
2
 
3
 
4
// Programme de migration jetable
5
include_once 'connect.php';
6
//bouh! c'est pas propre! c'est a cause de PEAR et de ses includes
7
set_include_path('configuration/'.PATH_SEPARATOR.get_include_path());
8
//librairies PEAR
9
require_once 'configuration/DB.php' ;
10
$dsn='mysql://'.$login.':'.$pass.'@'.$hote.'/'.$db;
11
//echo $dsn.'<br /><br />';
12
$GLOBALS['car_db'] =& DB::connect($dsn) ;
13
if (DB::isError($GLOBALS['car_db'])) {
14
 die ($GLOBALS['car_db']->getMessage());
15
}
16
 
17
$requete = 'SELECT STATION_ID, STATION_NOM, STATION_LATITUDE , STATION_LONGITUDE FROM STATION ';
18
 
19
 
20
$resultat = $GLOBALS['car_db']->query($requete) ;
21
 
22
if (DB::isError($resultat)) {
23
 die ($resultat->getMessage());
24
}
25
 
26
$i=1;
27
 
28
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
29
 
30
	  $alt = file_get_contents('http://ws.geonames.org/srtm3?lat='.$ligne['STATION_LATITUDE'].'&lng='.$ligne['STATION_LONGITUDE'], 'r') ;
31
 
32
 
33
 
34
     $requete3= 'UPDATE STATION SET STATION_ALTITUDE='.$alt.' WHERE STATION_ID='.$ligne['STATION_ID'].';';
35
 
36
    	echo $requete3.'<br/>';
37
 
38
    	$i++;
39
    //	if ($i==10) exit;
40
 
41
 
42
}
43
?>