2012-10-16 07:44:31 +00:00
#!/usr/bin/php -c/var/www/batch/config/php_batch_sd.ini
< ? php
include_once ( FWK_PATH . 'common/chiffres.php' );
include_once ( FWK_PATH . 'common/dates.php' );
include_once ( INCLUDE_PATH . 'insee/classMInsee.php' );
/* include_once ( INCLUDE_PATH . 'partenaires/classMMap.php' );
include_once ( INCLUDE_PATH . 'insee/classMSirene.php' );
include_once ( INCLUDE_PATH . 'partenaires/classMBilans.php' );
include_once ( INCLUDE_PATH . 'partenaires/classMBourse.php' );
include_once ( INCLUDE_PATH . 'partenaires/classMLiens.php' );
include_once ( INCLUDE_PATH . 'scores/classMFinancier.php' );
include_once ( INCLUDE_PATH . 'scores/classMSolvabilite.php' );
include_once ( INCLUDE_PATH . 'partenaires/classMTva.php' );
include_once ( INCLUDE_PATH . 'partenaires/classMGreffes.php' ); */
include_once ( INCLUDE_PATH . 'partenaires/classMOrias.php' );
include_once ( FWK_PATH . 'mail/sendMail.php' );
$iDb = new WDb ();
$iOrias = new MOrias ( true );
2013-06-19 08:24:49 +00:00
// Ann<6E> e 2007
2012-10-16 07:44:31 +00:00
$tabOrias = array ();
for ( $id = 0 ; $id <= 38829 ; $id ++ )
$tabOrias [] = ( '7' . sprintf ( '%06d' , $id )) * 1 ;
$nb = count ( $tabOrias );
shuffle ( $tabOrias );
foreach ( $tabOrias as $i => $numOrias ) {
//$numOrias=$or('7'.sprintf('%06d',$id))*1;
echo " $i / $nb : $numOrias ... " ;
print_r ( $iOrias -> getInfosOrias ( 0 , $numOrias ));
2013-06-19 08:24:49 +00:00
echo " $i / $nb : $numOrias ... r<> cup<75> r<EFBFBD> " ;
2012-10-16 07:44:31 +00:00
if ( ! $iOrias -> enCache ) { echo " via WWW. Attente... " . EOL ; randsleep ( 21 , 60 ); }
else echo " en cache ! " . EOL ;
}
2013-06-19 08:24:49 +00:00
@ sendMail ( 'production@scores-decisions.com' , 'ylenaour@scores-decisions.com' , " Pompe Orias - Ann<6E> e 2007 finie " , '...' ) ;
2012-10-16 07:44:31 +00:00
2013-06-19 08:24:49 +00:00
// Ann<6E> e 2008
2012-10-16 07:44:31 +00:00
$tabOrias = array ();
for ( $id = 38830 ; $id <= 46478 ; $id ++ )
$tabOrias [] = ( '8' . sprintf ( '%06d' , $id )) * 1 ;
$nb = count ( $tabOrias );
shuffle ( $tabOrias );
foreach ( $tabOrias as $i => $numOrias ) {
echo " $i / $nb : $numOrias ... " ;
print_r ( $iOrias -> getInfosOrias ( 0 , $numOrias ));
2013-06-19 08:24:49 +00:00
echo " $i / $nb : $numOrias ... r<> cup<75> r<EFBFBD> " ;
2012-10-16 07:44:31 +00:00
if ( ! $iOrias -> enCache ) { echo " via WWW. Attente... " . EOL ; randsleep ( 21 , 60 ); }
else echo " en cache ! " . EOL ;
}
2013-06-19 08:24:49 +00:00
@ sendMail ( 'production@scores-decisions.com' , 'ylenaour@scores-decisions.com' , " Pompe Orias - Ann<6E> e 2008 finie " , '...' ) ;
2012-10-16 07:44:31 +00:00
2013-06-19 08:24:49 +00:00
// Ann<6E> e 2009
2012-10-16 07:44:31 +00:00
$tabOrias = array ();
for ( $id = 46479 ; $id <= 52996 ; $id ++ )
$tabOrias [] = ( '9' . sprintf ( '%06d' , $id )) * 1 ;
$nb = count ( $tabOrias );
shuffle ( $tabOrias );
foreach ( $tabOrias as $i => $numOrias ) {
echo " $i / $nb : $numOrias ... " ;
print_r ( $iOrias -> getInfosOrias ( 0 , $numOrias ));
2013-06-19 08:24:49 +00:00
echo " $i / $nb : $numOrias ... r<> cup<75> r<EFBFBD> " ;
2012-10-16 07:44:31 +00:00
if ( ! $iOrias -> enCache ) { echo " via WWW. Attente... " . EOL ; randsleep ( 21 , 60 ); }
else echo " en cache ! " . EOL ;
}
2013-06-19 08:24:49 +00:00
@ sendMail ( 'production@scores-decisions.com' , 'ylenaour@scores-decisions.com' , " Pompe Orias - Ann<6E> e 2009 finie " , '...' ) ;
2012-10-16 07:44:31 +00:00
die (); /*
print_r ( $iOrias -> getInfosOrias ( 452599186 ));
print_r ( $iOrias -> getInfosOrias ( 482755741 ));
print_r ( $iOrias -> getInfosOrias ( 441921574 ));
die (); */
$res = $iDb -> select ( 'etablissements_old' , 'siren' , " source=2 AND actif=1 AND siege=1 AND adr_dep>0 AND cj >0 AND ape_entrep='6622Z' AND capital>=0 " , false , MYSQL_ASSOC );
$nb = count ( $res );
foreach ( $res as $i => $etab ) {
//$iOrias=new MOrias(true);
$siren = $etab [ 'siren' ];
echo " $i / $nb : $siren ... " ;
print_r ( $iOrias -> getInfosOrias ( $siren ));
2013-06-19 08:24:49 +00:00
echo " $i / $nb : $siren ... r<> cup<75> r<EFBFBD> " ;
2012-10-16 07:44:31 +00:00
if ( ! $iOrias -> enCache ) { echo " via WWW. Attente... " . EOL ; randsleep ( 7 , 21 ); }
else echo " en cache ! " . EOL ;
}
die ();
$iGeffes = new MGreffes ();
$etabG = $iGeffes -> getListesProcolVentes ();
echo $iGeffes -> libErreur ;
die ();
$iInsee = new MInsee ();
print_r ( $iInsee -> getIdentiteEntreprise ( 552144503 ));
die ();
$siren = 552144503 ;
$pids = array ();
$shm = ftok ( __FILE__ , 'c' );
$shm_id = shm_attach ( $shm );
$mutex = sem_get ( $shm );
define ( " _IDCOMP " , 1 );
$idComp = array ();
shm_put_var ( $shm_id , _IDCOMP , $idComp );
for ( $instance = 0 ; $instance < 6 ; $instance ++ )
{
$pid = pcntl_fork ();
if ( $pid == - 1 ) {
die ( 'could not fork' );
} else if ( $pid ) {
// we are in the parent
$pids [] = $pid ;
} else {
// we're in the child - download the movie
switch ( $instance ) {
case 0 : $iInsee = new MInsee ();
$idComp = $iInsee -> getIdentitePart ( $siren );
shm_put_var ( $shm_id , _IDCOMP , serialize ( $idComp ));
//;
break ;
case 1 : $mMap = new MMap ( true );
//$mMap->geoCodeAdresse($etab['adr_num'],'',$etab['adr_typeVoie'],$this->getCodeVoie($etab['adr_typeVoie']), $etab['adr_libVoie'], $etab['adr_cp'], $etab['adr_ville'], 'France', trim($tabInsee['ADR_DEP'].$tabInsee['ADR_COM'].$tabInsee['CODEVOIE']));
break ;
case 2 :
$iAmabis = new MAmabis ();
$repAmabis = $iAmabis -> getZonage ( $etab [ 'adr_num' ], $etab [ 'adr_btq' ], $etab [ 'adr_typeVoie' ], $etab [ 'adr_libVoie' ], $etab [ 'adr_cp' ], $etab [ 'adr_ville' ], trim ( $tabInsee [ 'ADR_DEP' ] . $tabInsee [ 'ADR_COM' ] . $tabInsee [ 'CODEVOIE' ]), false , 'TEST' , false );
print_r ( $repAmabis );
break ;
case 3 :
$iTva = new MTva ( $siren );
break ;
case 4 :
$iTel = new MTel ();
$tel = $iTel -> getTel ( $siren );
print_r ( $tel );
break ;
case 5 :
$iGeffes = new MGreffes ();
$etabG = $iGeffes -> getIdentite ( $siren );
print_r ( $etabG );
break ;
}
exit ();
}
}
foreach ( $pids as $pid ) {
pcntl_waitpid ( $pid , $status );
}
echo " =================================================================================================================================================================== " . EOL ;
echo " =================================================================================================================================================================== " . EOL ;
echo " =================================================================================================================================================================== " . EOL ;
echo " =================================================================================================================================================================== " . EOL ;
$idComp = unserialize ( shm_get_var ( $shm_id , _IDCOMP ));
print_r ( $idComp );
die ();
print_r ( $repAmabis );
print_r ( $tel );
print_r ( $etabG );
die ();
/**
* Code example
*
* More info available in http :// dev . juokaz . com /
*
* @ author Juozas Kaziukenas < juozas @ juokaz . com >
*/
echo " We start " . PHP_EOL ;
// Run tests
ob_end_flush ();
$time_start = microtime_float ();
parallel ();
$time_end = microtime_float ();
echo " Ran parallel " . ( $time_end - $time_start ) . " seconds " . PHP_EOL ;
$time_start = microtime_float ();
normal ();
$time_end = microtime_float ();
echo " Ran normal " . ( $time_end - $time_start ) . " seconds " . PHP_EOL ;
// Aditional funcions
function parallel () {
$pid = pcntl_fork ();
if ( $pid == - 1 ) {
die ( " could not fork " );
} else if ( $pid ) {
echo " I am the parent, pid = " . $pid . " \n " ;
work ( $pid );
pcntl_wait ( $status ); //Protect against Zombie children
} else {
echo " I am the child, pid = " . $pid . " \n " ;
work ( $pid );
exit (); //quit execution
}
}
function normal () {
work ( 1 );
work ( 2 );
work ( 3 );
work ( 4 );
}
function work ( $nr ) {
for ( $i = 0 ; $i < 1000000 ; $i ++ ) {
$j = $i ^ 3 ;
}
echo " yep, finished, I have " . $nr . " ID " . PHP_EOL ;
}
die ();
include_once ( '/var/www/html/ws/WsEntreprise.php' );
$tabSiren = array ( " 301610515 " ,
" 302278916 " ,
" 314045436 " ,
" 317863108 " ,
" 323456319 " ,
" 329274369 " ,
" 331843292 " ,
" 334692746 " ,
" 335034476 " ,
" 348576745 " ,
" 351269741 " ,
" 377535901 " ,
" 378937304 " ,
" 382276012 " ,
" 383081130 " ,
" 383381365 " ,
" 383844107 " ,
" 388988057 " ,
" 390099828 " ,
" 398271395 " ,
" 398809145 " ,
" 404750770 " ,
" 412908493 " ,
" 417544749 " ,
" 419536826 " ,
" 424691939 " ,
" 424716850 " ,
" 424977635 " ,
" 428141543 " ,
" 428969034 " ,
" 431416288 " ,
" 432160828 " ,
" 433891579 " ,
" 435002068 " ,
" 438325052 " ,
" 439105396 " ,
" 440371318 " ,
" 440482255 " ,
" 441719705 " ,
" 442711610 " ,
" 442757134 " ,
" 442839668 " ,
" 443138441 " ,
" 443420344 " ,
" 443420344 " ,
" 443420344 " ,
" 443420344 " ,
" 443999511 " ,
" 444560502 " ,
" 452536162 " ,
" 453423014 " ,
" 477650618 " ,
" 478119696 " ,
" 479686537 " ,
" 480764976 " ,
" 485158158 " ,
" 487734394 " ,
" 488383795 " ,
" 488626573 " ,
" 488878935 " ,
" 489168815 " ,
" 489488882 " ,
" 489575399 " ,
" 490093739 " ,
" 490407038 " ,
" 490407038 " ,
" 490407038 " ,
" 490407038 " ,
" 490498441 " ,
" 491074522 " ,
" 492015136 " ,
" 492107644 " ,
" 493372148 " ,
" 494967938 " ,
" 495174716 " ,
" 495341554 " ,
" 500668751 " ,
" 501465082 " ,
" 504023094 " ,
" 504078585 " ,
" 504588005 " ,
" 504589938 " ,
" 509729836 " ,
" 509749560 " ,
" 510377831 " ,
" 510746563 " ,
" 515161560 " ,
" 555750694 " ,
" 562000349 " ,
" 622620912 " );
$iWs = new WsEntreprise ();
foreach ( $tabSiren as $siren ) {
$tabScore =@ $iWs -> getRatios ( $siren );
$nbBilans = count ( $tabScore [ 'result' ][ 'BilansInfos' ]);
echo date ( 'Y/m/d - H:i:s' ) . " - Siren $siren : $nbBilans bilan(s) " . EOL ;
}
function wsLog ( $service , $siret = '' , $ref = '' ) {
}
die ();
ini_set ( 'soap.wsdl_cache_enabled' , 0 );
$imap = new MMap ();
echo ( $imap -> distance ( 48.0001945 , 1.0988452 , 48.0079422 , 1.0944768 ));
echo ( $imap -> distance ( 48 , 1 , 48.1 , 1.1 ));
$imap -> getCodeAdrCpVilleM ( " 4 rue des Champs Pierreux " , " " , 'Nanterre' );
$imap -> getCodeAdrCpVilleM ( " 1 " , " ggg " , " p " , 'rr' );
$imap -> getCodeAdrCpVilleM ( " 0007 AV RAYMOND FERAUD " , " " , " NICE " );
$imap -> getCodeAdrCpVilleM ( " 0007 RUE BOULINEAU " , " " , " GENTILLY " );
$imap -> getCodeAdrCpVilleM ( " 0005 RUE HANS LIST " , " " , " CROISSY SUR SEINE " );
$imap -> getCodeAdrCpVilleM ( " 0005 IMP DE L OURCQ " , " " , " MAUREPAS " );
$imap -> getCodeAdrCpVilleM ( " 0000 LA COMBAZ " , " " , " ESSERTS BLAY " );
$imap -> getCodeAdrCpVilleM ( " 0000 AV MADELEINE " , " " , " FLOURENS " );
$imap -> getCodeAdrCpVilleM ( " 0000 LE TEMPLE " , " " , " SAINT CIRQ MADELON " );
$imap -> getCodeAdrCpVilleM ( " 0002 RUE DE LA PETITE ILE " , " " , " JOIGNY " );
$imap -> getCodeAdrCpVilleM ( " 0014 RUE JEAN DE LA FONTAINE " , " " , " PAVANT " );
$imap -> getCodeAdrCpVilleM ( " 0000 PANASSAC " , " " , " COULAURES " );
$imap -> getCodeAdrCpVilleM ( " 0087 RUE GASPARD PROLONGEE " , " " , " ANICHE " );
die ();
/*
$client = new SoapClient ( 'http://maptp11.map24.com/map24/webservices1.5?soap=Map24Geocoder51' ,
array (
'trace' => 1 ,
'connection_timeout' => 2 ,
)
);
//print_r($client->__getFunctions());
/* < RequestHeader >
<>***</ Map24ID >
</ RequestHeader >
< GeocodeAddressesRequest >
< Address >
< Street > Goethestr .</ Street >
< City > Frankfurt </ City >
< ZIP > 60329 </ ZIP >
< Country > de </ Country >
</ Address >
</ Addresses >
</ GeocodeAddressesRequest >*
$RequestHeader = array ( 'Map24ID' => 0 );
$GeocodeAddressesRequest = array ( 'Addresses' => array ( 'Address' => array ( 'Street' => 'Dusseldorfer' ,
'City' => 'Eschborn' ,
'ZIP' => 63571 ,
'Country' => 'de' ,
),
),
'MaxNoOfAlternatives' => 1 ,
);
print_r ( $client -> geocodeAddresses ( $RequestHeader , $GeocodeAddressesRequest ));
*/
$client = new SoapClient ( 'http://webservices.viamichelin.com/ws2/services/Geocoding?wsdl' ,
array (
'trace' => 1 ,
'connection_timeout' => 2 ,
)
);
print_r ( $client -> __getFunctions ());
/* < RequestHeader >
<>***</ Map24ID >
</ RequestHeader >
< GeocodeAddressesRequest >
< Address >
< Street > Goethestr .</ Street >
< City > Frankfurt </ City >
< ZIP > 60329 </ ZIP >
< Country > de </ Country >
</ Address >
</ Addresses >
</ GeocodeAddressesRequest >*/
/* $RequestHeader = array ( 'Map24ID' => 0 );
$GeocodeAddressesRequest = array ( 'Addresses' => array ( 'Address' => array ( 'Street' => 'Dusseldorfer' ,
'City' => 'Eschborn' ,
'ZIP' => 63571 ,
'Country' => 'de' ,
),
),
'MaxNoOfAlternatives' => 1 ,
);
print_r ( $client -> geocodeAddresses ( $RequestHeader , $GeocodeAddressesRequest ));
*/
$login = '' ;
$password = '' ;
$authenticationParams = " $login | $password " ;
print_r ( $client -> getLocationsList ( $request , $authenticationParams ));
?>