Delete unused files
This commit is contained in:
parent
bf19153d1f
commit
dab0419214
@ -1,302 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class ICotation {
|
|
||||||
|
|
||||||
var $reTrtAuto;
|
|
||||||
var $tabBilan;
|
|
||||||
|
|
||||||
var $tabNotation;
|
|
||||||
var $tabLibActivite;
|
|
||||||
var $tabActivite;
|
|
||||||
var $tabR;
|
|
||||||
|
|
||||||
|
|
||||||
function ICotation ($tabBilan, $retraitementAutomatique=true) {
|
|
||||||
$this->reTrtAuto = $retraitementAutomatique;
|
|
||||||
$this->tabBilan = $tabBilan;
|
|
||||||
|
|
||||||
include ('paramCotation.inc');
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculProvisionsPourRisque () {
|
|
||||||
if ( !$this->reTrtAuto )
|
|
||||||
return $this->tabBilan['DP'] + $this->tabBilan['DQ'] - $this->tabBilan['X04'];
|
|
||||||
else
|
|
||||||
return (1/2*$this->tabBilan['DP'])+(1/2*$this->tabBilan['DQ']);
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculEBE () {
|
|
||||||
return $this->tabBilan['FC'] + $this->tabBilan['FF'] + $this->tabBilan['FI'] + $this->tabBilan['FOB']
|
|
||||||
+ $this->tabBilan['FM'] + $this->tabBilan['FN'] - $this->tabBilan['FC'] + $this->tabBilan['FC']
|
|
||||||
- ( $this->tabBilan['FS'] + $this->tabBilan['FT'] + $this->tabBilan['FU'] + $this->tabBilan['FV'] )
|
|
||||||
- ( $this->tabBilan['FW'] - $this->tabBilan['HP'] - $this->tabBilan['HQ'] - $this->tabBilan['HP2'] - $this->tabBilan['HQ2'] )
|
|
||||||
- $this->tabBilan['FX'] - ( $this->tabBilan['FY'] + $this->tabBilan['FZ'] ) + ( $this->tabBilan['FO'] - $this->tabBilan['FOB'] ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculChiffreAffaires () {
|
|
||||||
return $this->tabBilan['FC']
|
|
||||||
+ $this->tabBilan['FF']
|
|
||||||
+ $this->tabBilan['FI']
|
|
||||||
+ $this->tabBilan['FO']
|
|
||||||
- $this->tabBilan['FOB'] ;
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculMargeCommerciale () {
|
|
||||||
return $this->tabBilan['FC'] - ( $this->tabBilan['FS'] + $this->tabBilan['FT'] ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculProduction () {
|
|
||||||
return $this->tabBilan['FF'] + $this->tabBilan['FI'] + $this->tabBilan['FM'] + $this->tabBilan['FN'] ;
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculValeurAjoutee () {
|
|
||||||
return $this->calculMargeCommerciale() + $this->calculProduction()
|
|
||||||
- ( $this->tabBilan['FU'] + $this->tabBilan['FV'] + $this->tabBilan['FW'] ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculEBEnonCASA () {
|
|
||||||
return $this->calculValeurAjoutee() + $this->tabBilan['FO'] - $this->tabBilan['FX'] - ( $this->tabBilan['FY'] + $this->tabBilan['FZ'] ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculFondsPropresNetsCorriges() {
|
|
||||||
return $this->tabBilan['DA'] + $this->tabBilan['DC'] + $this->tabBilan['DB'] + $this->tabBilan['DD'] + $this->tabBilan['DE'] + $this->tabBilan['DF'] + $this->tabBilan['DG'] + $this->tabBilan['DK'] - (1/3*$this->tabBilan['X01'])
|
|
||||||
+ $this->tabBilan['DH'] + $this->tabBilan['DI'] + $this->tabBilan['DJ']
|
|
||||||
- $this->tabBilan['CL'] - $this->tabBilan['AB'] + $this->tabBilan['AC'] - $this->tabBilan['AA'] - $this->tabBilan['CB'] + $this->tabBilan['CC'] - $this->tabBilan['X02'] - $this->tabBilan['CM'] - $this->tabBilan['CN']
|
|
||||||
+ $this->tabBilan['DM'] + $this->tabBilan['DN']
|
|
||||||
- $this->tabBilan['X03'] + $this->calculProvisionsPourRisque() - $this->tabBilan['RAD'] ;
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculDettesFinancieresBancairesBrutes () {
|
|
||||||
return $this->tabBilan['DS'] - $this->tabBilan['CM1'] + $this->tabBilan['EI'] - $this->tabBilan['CM2']
|
|
||||||
+ $this->tabBilan['DT'] - $this->tabBilan['CM3'] + $this->tabBilan['DU'] - $this->tabBilan['EH']
|
|
||||||
+ (3/4*$this->tabBilan['YQ']) + (2/3*$this->tabBilan['YR'])
|
|
||||||
+ (3/4*$this->tabBilan['YQ2']) + (2/3*$this->tabBilan['YR2'])
|
|
||||||
+ $this->tabBilan['DV'] - $this->tabBilan['EI'] - $this->tabBilan['DVI1'] - $this->tabBilan['CM2']
|
|
||||||
+ $this->tabBilan['YS'] + $this->tabBilan['X08']
|
|
||||||
+ $this->tabBilan['EH'] + $this->tabBilan['VI1'] - ( $this->tabBilan['X20'] + $this->tabBilan['X21'] ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function noteCapitalisation () {
|
|
||||||
if ( !$this->reTrtAuto ) {
|
|
||||||
$autresDettesExploit = $this->tabBilan['EA'] - $this->tabBilan['EAVI1'] - $this->tabBilan['EAB'] + $this->tabBilan['EB'] + $this->tabBilan['X01'] + $this->tabBilan['X04'] ;
|
|
||||||
$dettesFiscalesSociales = $this->tabBilan['DY'] - $this->tabBilan['DYA'];
|
|
||||||
} else {
|
|
||||||
$autresDettesExploit = $this->tabBilan['EA'] - $this->tabBilan['EAVI1'] - $this->tabBilan['EAB'] + $this->tabBilan['EB'] + $this->tabBilan['X01'] + 2/3*((1/2*$this->tabBilan['DP'])+(1/2*$this->tabBilan['DQ']));
|
|
||||||
$dettesFiscalesSociales = $this->tabBilan['DY'] + 1/3*((1/2*$this->tabBilan['DP'])+(1/2*$this->tabBilan['DQ'])) - $this->tabBilan['DYA'] ;
|
|
||||||
}
|
|
||||||
|
|
||||||
$numerateur = $this->calculFondsPropresNetsCorriges();
|
|
||||||
|
|
||||||
$denominateur = $numerateur + $this->tabBilan['DS'] - $this->tabBilan['CM1'] + $this->tabBilan['EI'] - $this->tabBilan['CM2'] + $this->tabBilan['DU'] - $this->tabBilan['EH']
|
|
||||||
+ $this->tabBilan['DV'] - $this->tabBilan['DVI1'] - $this->tabBilan['EI'] + $this->tabBilan['DT'] - $this->tabBilan['CM3'] + 3/4*$this->tabBilan['YQ'] + 2/3*$this->tabBilan['YR']
|
|
||||||
+ 3/4*$this->tabBilan['YQ2'] + 2/3*$this->tabBilan['YR2']
|
|
||||||
+ $this->tabBilan['DW'] + $this->tabBilan['DX'] + $dettesFiscalesSociales
|
|
||||||
+ $autresDettesExploit + $this->tabBilan['DZ'] + $this->tabBilan['DIA'] + $this->tabBilan['ED'] + $this->tabBilan['EAB'] + $this->tabBilan['DYA']
|
|
||||||
+ $this->tabBilan['EH'] + $this->tabBilan['YS'] + $this->tabBilan['VI1'];
|
|
||||||
// + $this->tabBilan['X08']
|
|
||||||
// - $this->tabBilan['X20'] + $this->tabBilan['YS'] - $this->tabBilan['X08'];
|
|
||||||
|
|
||||||
if ($denominateur==0)
|
|
||||||
return array('NUMERATEUR'=>$numerateur*100,'DENOMINATEUR'=>$denominateur,'NOTE'=>0);
|
|
||||||
|
|
||||||
return array('NUMERATEUR'=>$numerateur* 100,'DENOMINATEUR'=>$denominateur,'NOTE'=>($numerateur* 100)/$denominateur);
|
|
||||||
}
|
|
||||||
|
|
||||||
function noteLevierEndettement () {
|
|
||||||
|
|
||||||
$numerateur = $this->calculDettesFinancieresBancairesBrutes();
|
|
||||||
|
|
||||||
$denominateur = $this->calculFondsPropresNetsCorriges();
|
|
||||||
|
|
||||||
if ($denominateur==0)
|
|
||||||
return array('NUMERATEUR'=>$numerateur,'DENOMINATEUR'=>$denominateur,'NOTE'=>0);
|
|
||||||
|
|
||||||
return array('NUMERATEUR'=>$numerateur,'DENOMINATEUR'=>$denominateur,'NOTE'=>$numerateur/$denominateur);
|
|
||||||
}
|
|
||||||
|
|
||||||
function noteCapaciteRemboursement () {
|
|
||||||
|
|
||||||
$numerateur = $this->calculDettesFinancieresBancairesBrutes();
|
|
||||||
|
|
||||||
$denominateur = $this->calculEBE();
|
|
||||||
|
|
||||||
if ($denominateur==0)
|
|
||||||
return array('NUMERATEUR'=>$numerateur,'DENOMINATEUR'=>$denominateur,'NOTE'=>0);
|
|
||||||
|
|
||||||
return array('NUMERATEUR'=>$numerateur,'DENOMINATEUR'=>$denominateur,'NOTE'=>$numerateur/$denominateur);
|
|
||||||
}
|
|
||||||
|
|
||||||
function noteCouvChargesFi () {
|
|
||||||
|
|
||||||
$numerateur = $this->calculEBE();
|
|
||||||
|
|
||||||
$denominateur = $this->tabBilan['GR'] + ( 1/4*$this->tabBilan['HP'] + 1/3*$this->tabBilan['HQ'] )
|
|
||||||
+ ( 1/4*$this->tabBilan['HP2'] + 1/3*$this->tabBilan['HQ2'] )
|
|
||||||
+ $this->tabBilan['GS']
|
|
||||||
+ $this->tabBilan['GT']
|
|
||||||
- $this->tabBilan['GJ']
|
|
||||||
- $this->tabBilan['GK']
|
|
||||||
- $this->tabBilan['GL']
|
|
||||||
- $this->tabBilan['GN']
|
|
||||||
- $this->tabBilan['GO']
|
|
||||||
- $this->tabBilan['GH']
|
|
||||||
+ $this->tabBilan['GI'] ;
|
|
||||||
|
|
||||||
if ($denominateur==0)
|
|
||||||
return array('NUMERATEUR'=>$numerateur,'DENOMINATEUR'=>$denominateur,'NOTE'=>0);
|
|
||||||
|
|
||||||
return array('NUMERATEUR'=>$numerateur,'DENOMINATEUR'=>$denominateur,'NOTE'=>$numerateur/$denominateur);
|
|
||||||
}
|
|
||||||
|
|
||||||
function noteTresorerie () {
|
|
||||||
|
|
||||||
$numerateur = $this->tabBilan['CD'] - $this->tabBilan['CE'] + $this->tabBilan['CF'] - $this->tabBilan['CG']
|
|
||||||
- $this->tabBilan['EH'] - ( $this->tabBilan['YS'] + $this->tabBilan['X08'] ) ;
|
|
||||||
|
|
||||||
$denominateur = $this->calculChiffreAffaires();
|
|
||||||
if ($denominateur==0)
|
|
||||||
return array('NUMERATEUR'=>$numerateur*360,'DENOMINATEUR'=>$denominateur,'NOTE'=>0);
|
|
||||||
|
|
||||||
return array('NUMERATEUR'=>$numerateur*360,'DENOMINATEUR'=>$denominateur,'NOTE'=>$numerateur*360/$denominateur);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function noteMargeExploitation () {
|
|
||||||
|
|
||||||
$numerateur = $this->calculEBE();
|
|
||||||
|
|
||||||
$denominateur = $this->calculChiffreAffaires();
|
|
||||||
|
|
||||||
if ($denominateur==0)
|
|
||||||
return array('NUMERATEUR'=>$numerateur*100,'DENOMINATEUR'=>$denominateur,'NOTE'=>0);
|
|
||||||
|
|
||||||
return array('NUMERATEUR'=>$numerateur*100,'DENOMINATEUR'=>$denominateur,'NOTE'=>$numerateur*100/$denominateur);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getSecteurActivite($naf) {
|
|
||||||
|
|
||||||
$nbSecteurs=count($this->tabActivite);
|
|
||||||
|
|
||||||
while (strlen($naf) > 1)
|
|
||||||
{
|
|
||||||
for ($i=1; $i<$nbSecteurs; $i++)
|
|
||||||
{
|
|
||||||
for ($j=0; isset($this->tabActivite[$i][$j]); $j++)
|
|
||||||
{
|
|
||||||
if ($this->tabActivite[$i][$j]==$naf)
|
|
||||||
// echo 'NAF '.$naf.' TROUVÉ !<br>';
|
|
||||||
return $i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// echo 'NAF '.$naf.' non trouvé !<br>';
|
|
||||||
$naf=substr($naf,0,strlen($naf)-1);
|
|
||||||
}
|
|
||||||
return 17; // Secteur d'activité par défaut si non trouvé
|
|
||||||
}
|
|
||||||
|
|
||||||
function getBorne($note, $borne, $secteur) {
|
|
||||||
|
|
||||||
// print_array($this->tabR[$borne][$secteur],0);
|
|
||||||
for ($j=0; $j<10; $j++)
|
|
||||||
{
|
|
||||||
$tabMinMax=explode(':',$this->tabR[$borne][$secteur][$j]);
|
|
||||||
if ($tabMinMax[0]!='') $min=$tabMinMax[0];
|
|
||||||
else $min=-1E99;
|
|
||||||
if ($tabMinMax[1]!='') $max=$tabMinMax[1];
|
|
||||||
else $max=1E99;
|
|
||||||
|
|
||||||
if ( ( $note>$min && $note<=$max ) )
|
|
||||||
{
|
|
||||||
// echo "TROUVE ++++ $note > ".$tabMinMax[0]." et $note <= ". $tabMinMax[1].'<br/>';
|
|
||||||
if ($j==0) return 3;
|
|
||||||
elseif ($j<4) return $j+4;
|
|
||||||
else return $j*2+1;
|
|
||||||
}
|
|
||||||
// echo "NOK $note < ".$tabMinMax[0]." ou $note > ". $tabMinMax[1].'<br/>';
|
|
||||||
}
|
|
||||||
return 3; // On retourne la plus basse note par défaut
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getNoteBorne($note, $borne, $secteur, $numerateur, $denominateur) {
|
|
||||||
|
|
||||||
$noteBorneBrute=$this->getBorne($note, $borne, $secteur);
|
|
||||||
|
|
||||||
switch($borne)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
if ($numerateur<0) return 3;
|
|
||||||
else return $noteBorneBrute;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if ($numerateur==0) return 19;
|
|
||||||
else return $noteBorneBrute;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
if ($numerateur==0 && $denominateur>0) return 19;
|
|
||||||
elseif ($denominateur<0) return 3;
|
|
||||||
else return $noteBorneBrute;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
if ($note<0) return 19;
|
|
||||||
else return $noteBorneBrute;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return $noteBorneBrute;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getNotationFin ($coteMoy) {
|
|
||||||
if( $coteMoy > 18.5 )
|
|
||||||
return 'A';
|
|
||||||
elseif( $coteMoy > 16 )
|
|
||||||
return 'B+';
|
|
||||||
elseif( $coteMoy > 14 )
|
|
||||||
return 'B';
|
|
||||||
elseif( $coteMoy > 12.5 )
|
|
||||||
return 'C+';
|
|
||||||
elseif( $coteMoy > 11 )
|
|
||||||
return 'C';
|
|
||||||
elseif( $coteMoy > 10 )
|
|
||||||
return 'C-';
|
|
||||||
elseif( $coteMoy > 9 )
|
|
||||||
return 'D+';
|
|
||||||
elseif( $coteMoy > 8 )
|
|
||||||
return 'D';
|
|
||||||
elseif( $coteMoy > 7 )
|
|
||||||
return 'D-';
|
|
||||||
elseif( $coteMoy > 6 )
|
|
||||||
return 'E+';
|
|
||||||
elseif( $coteMoy > 4.5 )
|
|
||||||
return 'E';
|
|
||||||
elseif( $coteMoy > 3 )
|
|
||||||
return 'E-';
|
|
||||||
else
|
|
||||||
return 'E--';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getInfosNotation ($notation, $csv=false) {
|
|
||||||
if ($csv) {
|
|
||||||
$str =$this->tabNotation[$notation][1].';'.
|
|
||||||
$this->tabNotation[$notation][2].';'.
|
|
||||||
$this->tabNotation[$notation][3].';'.
|
|
||||||
$this->tabNotation[$notation][4].';';
|
|
||||||
return $str;
|
|
||||||
} else {
|
|
||||||
$str ='Notation : '. $this->tabNotation[$notation][0]."\r\n";
|
|
||||||
$str.='Equivalence BDF : '. $this->tabNotation[$notation][1]."\r\n";
|
|
||||||
$str.='Grades Moody\'s : '. $this->tabNotation[$notation][2]."\r\n";
|
|
||||||
$str.='Grades S&P : '. $this->tabNotation[$notation][3]."\r\n";
|
|
||||||
$str.='Probabilité de défaillance : '. $this->tabNotation[$notation][4]." %\r\n";
|
|
||||||
return $str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
<?
|
|
||||||
|
|
||||||
function isinPoidsLettre($lettre) {
|
|
||||||
$ascii=ord($lettre);
|
|
||||||
if ($ascii>64 && $ascii<91 )
|
|
||||||
/* En ASCII : A=65 et Z=90
|
|
||||||
En ISIN... A=10 et Z=35 */
|
|
||||||
return ($ascii-55);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Test si un code ISIN donné est valable à partir de son algo de contrôle.
|
|
||||||
** @param string $isin Code ISIN à vérifier
|
|
||||||
** @return bool
|
|
||||||
**/
|
|
||||||
function isValidIsin($isin) {
|
|
||||||
|
|
||||||
$pays=substr($isin, 0,2);
|
|
||||||
$nsin=''.substr($isin, 2,9);
|
|
||||||
$clef=substr($isin,11,1)*1;
|
|
||||||
|
|
||||||
$calcul=''.isinPoidsLettre($pays[0]).isinPoidsLettre($pays[1]).$nsin;
|
|
||||||
//echo "Etape 1 = $calcul".EOL;
|
|
||||||
|
|
||||||
$sommeImpair=$sommePair=0;
|
|
||||||
for ($impair=0; $impair<12; $impair=$impair+2) {
|
|
||||||
$strImpair=''.$calcul[$impair]*2;
|
|
||||||
if (isset($strImpair[1])) $reste=$strImpair[1]*1;
|
|
||||||
else $reste=0;
|
|
||||||
$sommeImpair+=$strImpair[0]*1+$reste;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ($pair=1; $pair<12; $pair=$pair+2)
|
|
||||||
$sommePair+=$calcul[$pair]*1;
|
|
||||||
|
|
||||||
$totalcalcul=$sommeImpair+$sommePair;
|
|
||||||
//echo "Etape 3 = $sommeImpair + $sommePair = $totalcalcul".EOL;
|
|
||||||
|
|
||||||
$dizSuperieur=ceil($totalcalcul/10)*10;
|
|
||||||
$delta=$dizSuperieur-$totalcalcul;
|
|
||||||
//echo "Etape 4 = $dizSuperieur - $totalcalcul = $delta".EOL;
|
|
||||||
|
|
||||||
if ($delta==$clef) return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
?>
|
|
@ -1,339 +0,0 @@
|
|||||||
<?
|
|
||||||
/** Parse une page Html et retourne son contenu dans un tableau :
|
|
||||||
** "code" => Code réponse Serveur
|
|
||||||
** "header" => Headers du serveur
|
|
||||||
** "body" => Page HTML
|
|
||||||
**/
|
|
||||||
function parse_response($this_response) {
|
|
||||||
|
|
||||||
|
|
||||||
// Split response into header and body sections
|
|
||||||
list($response_headers, $response_body) = explode("\r\n\r\n", $this_response, 2);
|
|
||||||
$response_header_lines = explode("\r\n", $response_headers);
|
|
||||||
|
|
||||||
// First line of headers is the HTTP response code
|
|
||||||
$http_response_line = array_shift($response_header_lines);
|
|
||||||
if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { $response_code = $matches[1]; }
|
|
||||||
|
|
||||||
// put the rest of the headers in an array
|
|
||||||
$response_header_array = array();
|
|
||||||
$nbRMID=0;
|
|
||||||
foreach($response_header_lines as $header_line)
|
|
||||||
{
|
|
||||||
list($header,$value) = explode(': ', $header_line, 2);
|
|
||||||
|
|
||||||
if ($header=='Set-cookie' && substr($value,0,5)=='RMID=' && $nbRMID<5)//{
|
|
||||||
$nbRMID++;
|
|
||||||
// echo ("Je gicle le RMID n°$nbRMID\r\n");}
|
|
||||||
else
|
|
||||||
$response_header_array[$header] .= $value."\n";
|
|
||||||
}
|
|
||||||
return array('code' => $response_code, 'header' => $response_header_array, 'body' => $response_body);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Récupère une page HTML en fonction des paramètres :
|
|
||||||
** $url Url distante de la page à récupérer
|
|
||||||
** $strCookies Chaine de caractère contenant les cookies
|
|
||||||
** $postData Tableau des données à passer en POST uniquement
|
|
||||||
** $referer Referer à indiquer lors de l'appel de la page
|
|
||||||
** $debug Activer le débogage (True/False)
|
|
||||||
**
|
|
||||||
** ... et retourne son contenu dans un tableau :
|
|
||||||
** "code" => Code réponse Serveur
|
|
||||||
** "header" => Headers du serveur
|
|
||||||
** "body" => Page HTML
|
|
||||||
**/
|
|
||||||
function getUrl($url, $strCookies='', $postData='', $referer='', $debug=false, $host='') {
|
|
||||||
|
|
||||||
|
|
||||||
$ch = curl_init();
|
|
||||||
|
|
||||||
if ($host=='')
|
|
||||||
$this_header = array('Host: '. HOST_INSEE);
|
|
||||||
else
|
|
||||||
$this_header = array('Host: '. $host);
|
|
||||||
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
|
||||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
|
||||||
//curl_setopt($ch, CURLOPT_PROXY, '10.142.10.254:80');
|
|
||||||
//curl_setopt($ch, CURLOPT_PROXYUSERPWD, 'username:password'); // Pas nécessaire en authentification NT
|
|
||||||
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
||||||
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
|
||||||
//curl_setopt($ch, CURLOPT_MAXREDIRS, 1);
|
|
||||||
|
|
||||||
$user_agent = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
|
|
||||||
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
|
|
||||||
curl_setopt($ch, CURLOPT_REFERER, $referer);
|
|
||||||
|
|
||||||
// Add each cookie that has been returned in the response
|
|
||||||
// If cookies need to be added/deleted or value changed, then add code here
|
|
||||||
if ($strCookies!='') {
|
|
||||||
//die('"'.$strCookies.'"');
|
|
||||||
//echo $strCookies."\r\n";
|
|
||||||
$cookies = explode("\n", $strCookies);
|
|
||||||
// Create the basic header
|
|
||||||
foreach($cookies as $this_cookie) {
|
|
||||||
if (trim($this_cookie)<>'')
|
|
||||||
array_push($this_header, 'Cookie: '.$this_cookie);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($postData!='') {
|
|
||||||
if (is_array($postData))
|
|
||||||
$post_data=$postData;
|
|
||||||
|
|
||||||
$o="";
|
|
||||||
foreach ($post_data as $k=>$v)
|
|
||||||
{
|
|
||||||
$o.= "$k=".utf8_encode($v)."&";
|
|
||||||
}
|
|
||||||
$post_data=substr($o,0,-1);
|
|
||||||
|
|
||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
|
|
||||||
//if in_array('',$this_header
|
|
||||||
/*array_push($this_header, "Content-type: application/x-www-form-urlencoded");
|
|
||||||
array_push($this_header, "Content-Length: 44");*/
|
|
||||||
}
|
|
||||||
|
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $this_header);
|
|
||||||
//print_r($this_header);
|
|
||||||
|
|
||||||
$page=curl_exec($ch);
|
|
||||||
$response = parse_response($page);
|
|
||||||
if ($debug){
|
|
||||||
$url2=str_replace('http://', '', $url);
|
|
||||||
$url2=str_replace('/', '_', $url2);
|
|
||||||
$url2=str_replace('?', '(param)', $url2);
|
|
||||||
$url2=str_replace('&', '(et)', $url2);
|
|
||||||
|
|
||||||
|
|
||||||
$fp=fopen('/var/www/_includes/partenaires/insee/'. date('Ymd-His') .'-'. microtime_float(true) .'-'. $url2 . '.html', 'a');
|
|
||||||
fwrite($fp, $url."\r\n");
|
|
||||||
fwrite($fp, $page);
|
|
||||||
fclose($fp);
|
|
||||||
//echo strip_tags(html_entity_decode($response['body']), '<td>');
|
|
||||||
}
|
|
||||||
//print_r(curl_getinfo($ch));
|
|
||||||
curl_close($ch);
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function rechercheTelephone($raisonSociale='', $adresse='', $localite='', $departement='', $activite='') {
|
|
||||||
|
|
||||||
$response1=getUrl(SITE_PJ.'pj.cgi?', '', '', '', true, HOST_PJ);
|
|
||||||
//print_r($response1['header']['Set-cookie']);
|
|
||||||
$pageHtml=$response1['body'];
|
|
||||||
$SESSION_ID=getTextInHtml($pageHtml, '<input type="hidden" name="SESSION_ID" value="', ' value="', '">');
|
|
||||||
$VID=getTextInHtml($pageHtml, '<input type="hidden" name="VID" value="', ' value="', '">');
|
|
||||||
$e_cookie=getTextInHtml($pageHtml, '<noscript><img ALT="" src="http://e.pagesjaunes.fr/m/web/', 'src="', '" BORDER=0 width=1 height=1></noscript>');
|
|
||||||
|
|
||||||
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/pji.css', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/pji_PJ.css', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/script_open.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/alerte.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/script_VED.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
$response=getUrl(SITE_PJ.'sitecrm/popup.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/AUTOPROMO_PJ_banniere_activite/hotel_pj.swf?clickTAG=http://sbx.pagesjaunes.fr/RealMedia/ads/click_lx.ads/www.pagesjaunes.fr/GENERAL/GENERAL/PJ/1238513556/Top/OasDefault/AUTOPROMO_PJ_banniere_activite/hotel_pj.html/61633130323433353434346339306330?', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
$response=getUrl(SITE_PJ.'files/look2002/FR/commun/script_VED.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/EDITO_HOME_RIGHT/anim_HP_v2-04-2006.swf', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/EDITO_HOME_RIGHT/visuels_webcam.swf', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/EDITO_HOME_RIGHT/visuels_photo.swf', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/EDITO_HOME_RIGHT/visuels_trafic.swf', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
$response=getUrl('http://sbx.pagesjaunes.fr/RealMedia/ads/Creatives/OasDefault/Edito_webcams/new_04-2006.jpg', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
$response=getUrl('http://e.pagesjaunes.fr/js/m.js', '', '', SITE_PJ.'pj.cgi?', false, HOST_PJ);
|
|
||||||
|
|
||||||
$response2=getUrl($e_cookie, $response1['header']['Set-cookie'], '', SITE_PJ, true, HOST_PJ);
|
|
||||||
|
|
||||||
$cookies=$response1['header']['Set-cookie'] . $response2['header']['Set-Cookie'];
|
|
||||||
|
|
||||||
$input_image=$VALID_ARR=$NUM_RUE=$NEW_DEPARTEMENT=$OBJ_GEO='';
|
|
||||||
|
|
||||||
// Requête d'interrogation
|
|
||||||
$postData=array(
|
|
||||||
'ACTIVITE_VALIDATED_ASCII'=>'',
|
|
||||||
'ID_THEME_SDE'=>'',
|
|
||||||
'LISTE_RUB_AVEC_THEME'=>'',
|
|
||||||
'input_image'=>$input_image,
|
|
||||||
|
|
||||||
'FRM_ACTIVITE'=>$activite,
|
|
||||||
'FRM_NOM'=>$raisonSociale,
|
|
||||||
'FRM_ADRESSE'=>$adresse,
|
|
||||||
'FRM_LOCALITE'=>$localite,
|
|
||||||
'FRM_DEPARTEMENT'=>$departement,
|
|
||||||
|
|
||||||
'JF_INSCRIPTIONS_REQ.x'=>'25',
|
|
||||||
'JF_INSCRIPTIONS_REQ.y'=>'4',
|
|
||||||
'faire'=>'decode_input_image',
|
|
||||||
'DEFAULT_ACTION'=>'jf_inscriptions_req',
|
|
||||||
'SESSION_ID'=>$SESSION_ID,
|
|
||||||
'VID'=>$VID,
|
|
||||||
'INFO_VILLE'=>'non',
|
|
||||||
'CODE_LOC_INFO_VILLE'=>'00000000',
|
|
||||||
'IV_ACTIVATION'=>'oui',
|
|
||||||
'lang'=>'FR',
|
|
||||||
'pays'=>'FR',
|
|
||||||
'srv'=>'PJ',
|
|
||||||
'TYPE_RECHERCHE'=>'ZZZ');
|
|
||||||
//print_r($postData);//die();
|
|
||||||
sleep(1);
|
|
||||||
$response=getUrl(SITE_PJ, $cookies, $postData, SITE_PJ, true, HOST_PJ);
|
|
||||||
$pageHtml=$response['body'];
|
|
||||||
|
|
||||||
if (count($tabNT=getTabListeNonTrouve($pageHtml))>0)
|
|
||||||
{
|
|
||||||
// Pas de réponses pour ces critères
|
|
||||||
// Il faut élargir la recherche !
|
|
||||||
$tabNTk=array_keys($tabNT);
|
|
||||||
$input_image=$tabNT[0];
|
|
||||||
$DEFAULT_ACTION='inscriptions_req';
|
|
||||||
$NEW_DEPARTEMENT=getTextInHtml($pageHtml, '<input type="hidden" name="NEW_DEPARTEMENT" value="', 'value="', '">');
|
|
||||||
$OBJ_GEO=getTextInHtml($pageHtml, '<input type=hidden name=OBJ_GEO value="', 'value="', '">');
|
|
||||||
}
|
|
||||||
elseif (count($tabGU=getTabListeGU($pageHtml))>0)
|
|
||||||
{
|
|
||||||
// Plusieurs Adresses possibles pour l'adresse donnée
|
|
||||||
// print_r($tabGU);
|
|
||||||
$input_image=getBonneAdresse($adresse, $tabGU);
|
|
||||||
$DEFAULT_ACTION='jf_inscriptions_req';
|
|
||||||
$VALID_ARR=getTextInHtml($pageHtml, '<input type=hidden name=VALID_ARR value="', 'value="', '">');
|
|
||||||
$NUM_RUE=getTextInHtml($pageHtml, '<input type=hidden name=NUM_RUE value="', 'value="', '">');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($input_image<>'') {
|
|
||||||
$CODE_LOC_INFO_VILLE=getTextInHtml($pageHtml, '<input type="hidden" name="CODE_LOC_INFO_VILLE" value="', 'value="', '">');
|
|
||||||
|
|
||||||
$postData=array(
|
|
||||||
'GEO_DEP'=>'', // New
|
|
||||||
'faire'=>'decode_input_image',
|
|
||||||
'DEFAULT_ACTION'=>$DEFAULT_ACTION,
|
|
||||||
'input_image'=>$input_image,// diff
|
|
||||||
'SESSION_ID'=>$SESSION_ID,
|
|
||||||
'VID'=>$VID,
|
|
||||||
'INFO_VILLE'=>'oui', // non dans la recherche préc.
|
|
||||||
'CODE_LOC_INFO_VILLE'=>$CODE_LOC_INFO_VILLE, // diff
|
|
||||||
'IV_ACTIVATION'=>'oui',
|
|
||||||
'lang'=>'FR',
|
|
||||||
'pays'=>'FR',
|
|
||||||
'srv'=>'PJ',
|
|
||||||
'TYPE_RECHERCHE'=>'CLOC', // ZZZ
|
|
||||||
'SAV_ADRESSE'=>$adresse, //
|
|
||||||
'SAV_LOCALITE'=>$localite, // New
|
|
||||||
'SAV_DEPARTEMENT'=>$departement, //
|
|
||||||
'FRM_NOM'=>$raisonSociale,
|
|
||||||
'FRM_ADRESSE'=>$adresse,
|
|
||||||
'FRM_LOCALITE'=>$localite,
|
|
||||||
'FRM_DEPARTEMENT'=>$departement,
|
|
||||||
|
|
||||||
'FRM_TYPE_PUB'=>'TOUS',
|
|
||||||
'RP_FORM'=>'',
|
|
||||||
'VALID_LOC'=>$CODE_LOC_INFO_VILLE,
|
|
||||||
'VALID_ARR'=>$VALID_ARR,
|
|
||||||
'NUM_RUE'=>$NUM_RUE,
|
|
||||||
'test_flash'=>'',
|
|
||||||
'ESPLUS'=>'',
|
|
||||||
'NEW_DEPARTEMENT'=>$NEW_DEPARTEMENT,
|
|
||||||
'OBJ_GEO'=>$OBJ_GEO,
|
|
||||||
);
|
|
||||||
print_r($postData);
|
|
||||||
sleep(1);
|
|
||||||
$response=getUrl(SITE_PJ, $cookies, $postData, SITE_PJ, true, HOST_PJ);
|
|
||||||
$pageHtml=$response['body'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$nbReponses=trim(getTextInHtml($pageHtml, '<tr><td align="left" class=txtrequetetotal valign=middle nowrap><b>', '<b>', 'réponse(s)</b></td>'));
|
|
||||||
$tabRep=getTabResponses($pageHtml);
|
|
||||||
|
|
||||||
if (count($tabRep)==$nbReponses)
|
|
||||||
return $tabRep;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTabResponses($pageHtml) {
|
|
||||||
|
|
||||||
$tabRepTmp=explode ('class=fdinscr', $pageHtml);
|
|
||||||
$tabRep=array();
|
|
||||||
foreach($tabRepTmp as $key => $value)
|
|
||||||
{
|
|
||||||
if ($key>0) {
|
|
||||||
$raisonSociale=getTextInHtml($value, 'class=fdrsinscr', '<b>', '</b>');
|
|
||||||
$ligneAdresse=html_entity_decode(getTextInHtml($value, '<td align="left" class=txtinscr ><b>', '<b>', '|'));
|
|
||||||
$tabligneAdresse=explode('<br>', $ligneAdresse);
|
|
||||||
$ligneAdresse1=strip_tags($tabligneAdresse[0]);
|
|
||||||
$ligneAdresse2=strip_tags($tabligneAdresse[1]);
|
|
||||||
$dispoPlan =(bool)(strpos($value, '<b>Plan</b>'));
|
|
||||||
$dispoIti =(bool)(strpos($value, '<b>Itinéraire</b>'));
|
|
||||||
$dispoPhoto =(bool)(strpos($value, '<b>Photo</b>'));
|
|
||||||
$dispoWeb =(bool)(strpos($value, '<b>Site</b></a> '));
|
|
||||||
$lienWeb=getTextInHtml($value, '<a target="_blank" href="http://www.pagesjaunes.fr/CGI/MOD?', 'href="', '" ');
|
|
||||||
$page=getUrl($lienWeb, '', '', '', true);
|
|
||||||
$lienWeb=$page['header']['Location'];
|
|
||||||
|
|
||||||
/*echo "Enreg n°$key : RS='$raisonSociale'\r\n";
|
|
||||||
echo "Enreg n°$key : Adresse1='$ligneAdresse1'\r\n";
|
|
||||||
echo "Enreg n°$key : Adresse2='$ligneAdresse2'\r\n";
|
|
||||||
echo "Enreg n°$key : Plan ?='$dispoPlan'\r\n";
|
|
||||||
echo "Enreg n°$key : Itineraire ?='$dispoIti'\r\n";
|
|
||||||
echo "Enreg n°$key : Photo ?='$dispoPhoto'\r\n";
|
|
||||||
echo "Enreg n°$key : Web ?='$dispoWeb'\r\n";
|
|
||||||
echo "Enreg n°$key : Site WEB='$lienWeb'\r\n\r\n";*/
|
|
||||||
array_push($tabRep, array( 'raisonSociale' =>$raisonSociale,
|
|
||||||
'AdresseLigne1' =>$ligneAdresse1,
|
|
||||||
'AdresseLigne2' =>$ligneAdresse2,
|
|
||||||
'Dispo_Plan' =>$dispoPlan,
|
|
||||||
'Dispo_Iti' =>$dispoIti,
|
|
||||||
'Dispo_Photo' =>$dispoPhoto,
|
|
||||||
'Dispo_Web' =>$dispoWeb,
|
|
||||||
'LienWeb' =>$lienWeb));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $tabRep;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getBonneAdresse($adresse, $tabGU) {
|
|
||||||
|
|
||||||
// tableau de mots à vérifier
|
|
||||||
$words = array_keys($tabGU);
|
|
||||||
|
|
||||||
// aucune distance de trouvée pour le moment
|
|
||||||
$shortest = -1;
|
|
||||||
|
|
||||||
// boucle sur les des mots pour trouver le plus près
|
|
||||||
foreach ($words as $word) {
|
|
||||||
|
|
||||||
// calcule la distance avec le mot mis en entrée,
|
|
||||||
// et le mot courant
|
|
||||||
$lev = levenshtein($adresse, $word);
|
|
||||||
|
|
||||||
// cherche une correspondance exacte
|
|
||||||
if ($lev == 0) {
|
|
||||||
|
|
||||||
// le mot le plus près est celui-ci (correspondance exacte)
|
|
||||||
$closest = $word;
|
|
||||||
$shortest = 0;
|
|
||||||
|
|
||||||
// on sort de la boucle ; nous avons trouvé une correspondance exacte
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si la distance est plus petite que la prochaine distance trouvée
|
|
||||||
// OU, si le prochain mot le plus près n'a pas encore été trouvé
|
|
||||||
if ($lev <= $shortest || $shortest < 0) {
|
|
||||||
// définission du mot le plus près ainsi que la distance
|
|
||||||
$closest = $word;
|
|
||||||
$shortest = $lev;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
echo "Mot entré : $adresse\n";
|
|
||||||
if ($shortest == 0) {
|
|
||||||
echo "Correspondance exacte trouvée : $closest\n";
|
|
||||||
} else {
|
|
||||||
echo "Vous voulez dire : $closest ?\n";
|
|
||||||
}*/
|
|
||||||
return $tabGU[$closest];
|
|
||||||
}
|
|
||||||
?>
|
|
@ -1,548 +0,0 @@
|
|||||||
<?
|
|
||||||
class Insee {
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDataEtablissement($pageHtml)
|
|
||||||
{
|
|
||||||
global $libelleErreur;
|
|
||||||
|
|
||||||
$responseSiege=$pageHtml;
|
|
||||||
$tabRet=array();
|
|
||||||
|
|
||||||
// On recherche si on est sur un établissement siège ou secondaire
|
|
||||||
$pos=strpos($pageHtml, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Etablissement</B>');
|
|
||||||
if ($pos>0)
|
|
||||||
$tabRet['typeEtablissement']='secondaire';
|
|
||||||
|
|
||||||
$pos=strpos($pageHtml, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche siège</B>');
|
|
||||||
if ($pos>0)
|
|
||||||
$tabRet['typeEtablissement']='siège';
|
|
||||||
|
|
||||||
// Recherche Dernière MAJ / Activité
|
|
||||||
$pos=strpos($responseSiege, '<font face="Arial" size="2">(dernière mise à jour :');
|
|
||||||
if ($pos>0) {
|
|
||||||
$tabRet['dateMAJ']=substr($responseSiege, $pos+51, 10);
|
|
||||||
$tabRet['dateAbsActivite']='';
|
|
||||||
$tabRet['active']='O';
|
|
||||||
} else {
|
|
||||||
$tabRet['active']='N';
|
|
||||||
$tabRet['dateMAJ']='';
|
|
||||||
$pos=strpos($responseSiege, '<font face="Arial" size="2">Absence d\'activité notée le : ');
|
|
||||||
if ($pos>0) $tabRet['dateAbsActivite']=substr($responseSiege, $pos+78, 10);
|
|
||||||
else {
|
|
||||||
$pos=strpos($responseSiege, '<font face="Arial" size="2">Absence d\'activité');
|
|
||||||
if ($pos>0) $tabRet['dateAbsActivite']='';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$pos=strpos($responseSiege, ' size="-1"> <B>n° SIRET :</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
|
|
||||||
$tabRet['siret']=str_replace(' ', '', html_entity_decode(substr($responseSiege, $pos+97, 32)));
|
|
||||||
|
|
||||||
$pos=strpos($responseSiege, 'size="-1"> <B>Date de création :</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
|
|
||||||
if ($pos>0) {
|
|
||||||
$posFin=strpos($responseSiege, '</font>', $pos+109);
|
|
||||||
$tabRet['dateCreation']=str_replace(' ', '', html_entity_decode(substr($responseSiege, $pos+109, $posFin-($pos+109))));
|
|
||||||
}
|
|
||||||
else $tabRet['dateCreation']='';
|
|
||||||
|
|
||||||
$pos=strpos($responseSiege, ' size="-1"> <B>Raison sociale et Enseigne :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
|
||||||
$len=127;
|
|
||||||
if ($pos==0){
|
|
||||||
$pos=strpos($responseSiege, ' size="-1"> <B>Raison sociale et Enseigne :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
|
||||||
$len=122;
|
|
||||||
if ($pos==0){
|
|
||||||
$pos=strpos($responseSiege, ' size="-1"> <B>Raison sociale et Enseigne :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
|
||||||
$len=126;
|
|
||||||
$libelleErreur='Informations INSEE non diffusables';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($libelleErreur=='') {
|
|
||||||
//LARGE*DOMINIQUE MICHEL/ <BR>GERANT SARL BIMAGIQUE </font>
|
|
||||||
$posFin=strpos($responseSiege, '</font>', $pos+$len);
|
|
||||||
$raisonSocialeStr=trim(substr($responseSiege, $pos+$len, $posFin-($pos+$len)));
|
|
||||||
$raisonSocialeTabLigne=explode('<BR>', $raisonSocialeStr);
|
|
||||||
$tabRet['raisonSociale']=trim(str_replace(' ', '', html_entity_decode($raisonSocialeTabLigne[0])));
|
|
||||||
$tabRet['Enseigne']=trim(str_replace(' ', '', html_entity_decode($raisonSocialeTabLigne[1])));
|
|
||||||
|
|
||||||
$pos=strpos($responseSiege, ' size="-1"> <B>Activité principale :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
|
||||||
$tabRet['NafCode']=substr($responseSiege, $pos+120, 4);
|
|
||||||
$tabRet['NafLib']=trim(substr($responseSiege, $pos+137, 70));
|
|
||||||
|
|
||||||
$pos=strpos($responseSiege, ' size="-1"> <B>Adresse :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
|
||||||
$posFin=strpos($responseSiege, '</font>', $pos+103);
|
|
||||||
$AdresseStr=substr($responseSiege, $pos+103, $posFin-($pos+103));
|
|
||||||
$AdresseTabLigne=explode('<BR>', $AdresseStr);//'
|
|
||||||
$tabRet['AdresseLigne1']=str_replace(' ', '/', $AdresseTabLigne[0]);
|
|
||||||
$tabRet['AdresseLigne2']=str_replace(' ', '/', $AdresseTabLigne[1]);
|
|
||||||
$tabRet['AdresseLigne3']=str_replace(' ', '/', $AdresseTabLigne[2]);
|
|
||||||
/*
|
|
||||||
$AdresseNum=$AdresseTabLigne1[0];
|
|
||||||
$AdresseVoi=$AdresseTabLigne1[1];
|
|
||||||
$AdresseRue=$AdresseTabLigne1[2];
|
|
||||||
$AdresseCP=$AdresseTabLigne2[0];
|
|
||||||
$AdresseVille=$AdresseTabLigne2[1];
|
|
||||||
*/
|
|
||||||
$pos=strpos($responseSiege, '<font face="Arial" size="-1"><b>L\'entreprise est connue au répertoire comme ');
|
|
||||||
if ($pos>0) {
|
|
||||||
$posFin=strpos($responseSiege, '</b>', $pos+106);
|
|
||||||
$tabRet['etatJuridique']=html_entity_decode(substr($responseSiege, $pos+106, $posFin-($pos+106)));
|
|
||||||
$tabRet['dateEtatJuridique']='';
|
|
||||||
} else {
|
|
||||||
$pos=strpos($responseSiege, '<font face="Arial" size="-1"><b>L\'entreprise est cessée le : ');
|
|
||||||
$tabRet['dateEtatJuridique']=substr($responseSiege, $pos+86, 10);
|
|
||||||
$tabRet['etatJuridique']='cessée';
|
|
||||||
}
|
|
||||||
//echo 'GetDataEtab="'.$libelleErreur."\"\r\n";
|
|
||||||
|
|
||||||
return $tabRet;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getDataEntreprise($pageHtml)
|
|
||||||
{
|
|
||||||
global $libelleErreur;
|
|
||||||
|
|
||||||
$responseEntreprise=$pageHtml;
|
|
||||||
$tabRet=array();
|
|
||||||
|
|
||||||
if ($libelleErreur=='') {
|
|
||||||
|
|
||||||
$pos=strpos($responseEntreprise, 'size="-1"> <B>Date de création :</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
|
|
||||||
if ($pos>0)
|
|
||||||
$tabRet['dateCreationEntrep']=substr($responseEntreprise, $pos+109, 10);
|
|
||||||
else
|
|
||||||
$tabRet['dateCreationEntrep']='';
|
|
||||||
|
|
||||||
// Raison sociale et Sigle
|
|
||||||
$pos=strpos($responseEntreprise, ' size="-1"> <B>Raison sociale et Sigle :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
|
||||||
$posFin=strpos($responseEntreprise, '</font>', $pos+123);
|
|
||||||
$raisonSocialeStr=trim(substr($responseEntreprise, $pos+123, $posFin-($pos+123)));
|
|
||||||
$raisonSocialeTabLigne=explode('<BR>', $raisonSocialeStr);
|
|
||||||
$tabRet['raisonSocialeEntrep']=trim(str_replace(' ', '', html_entity_decode($raisonSocialeTabLigne[0])));
|
|
||||||
$tabRet['sigle']=trim(str_replace(' ', '', html_entity_decode($raisonSocialeTabLigne[1])));
|
|
||||||
|
|
||||||
// Activité prinicpale Entrep
|
|
||||||
$pos=strpos($responseEntreprise, ' size="-1"> <B>Activité principale :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
|
||||||
$tabRet['NafCodeEntrep']=substr($responseEntreprise, $pos+120, 4);
|
|
||||||
$tabRet['NafLibEntrep']=trim(substr($responseEntreprise, $pos+137, 70));
|
|
||||||
|
|
||||||
// Forme Juridique
|
|
||||||
$pos=strpos($responseEntreprise, ' size="-1"> <B>Forme juridique :</B></FONT></td><td valign="top" colspan="3"><font face="Arial" size="-1">');
|
|
||||||
$tabRet['FJCodeEntrep']=substr($responseEntreprise, $pos+116, 4);
|
|
||||||
$tabRet['FJLibEntrep']=trim(substr($responseEntreprise, $pos+133, 70));
|
|
||||||
|
|
||||||
// Nb Etab Actifs
|
|
||||||
$pos=strpos($responseEntreprise, ' size="-1"> <B>Nb établissements actifs :</B></FONT></td><td valign="top"><font face="Arial" size="-1">');
|
|
||||||
$posFin=strpos($responseEntreprise, '</font>', $pos+118);
|
|
||||||
$tabRet['nbEtabActifs']=trim(str_replace(' ', '', html_entity_decode(substr($responseEntreprise, $pos+118, $posFin-($pos+118)))));
|
|
||||||
}
|
|
||||||
return $tabRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* parseHtml.php
|
|
||||||
* Author: Carlos Costa Jordao
|
|
||||||
* Email: carlosjordao@yahoo.com
|
|
||||||
*
|
|
||||||
* My notation of variables:
|
|
||||||
* i_ = integer, ex: i_count
|
|
||||||
* a_ = array, a_html
|
|
||||||
* b_ = boolean,
|
|
||||||
* s_ = string
|
|
||||||
*
|
|
||||||
* What it does:
|
|
||||||
* - parses a html string and get the tags
|
|
||||||
* - exceptions: html tags like <br> <hr> </a>, etc
|
|
||||||
* - At the end, the array will look like this:
|
|
||||||
* ["IMG"][0]["SRC"] = "xxx"
|
|
||||||
* ["IMG"][1]["SRC"] = "xxx"
|
|
||||||
* ["IMG"][1]["ALT"] = "xxx"
|
|
||||||
* ["A"][0]["HREF"] = "xxx"
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function parseHtml( $s_str )
|
|
||||||
{
|
|
||||||
$i_indicatorL = 0;
|
|
||||||
$i_indicatorR = 0;
|
|
||||||
$s_tagOption = '';
|
|
||||||
$i_arrayCounter = 0;
|
|
||||||
$a_html = array();
|
|
||||||
// Search for a tag in string
|
|
||||||
while( is_int(($i_indicatorL=strpos($s_str,'<',$i_indicatorR))) ) {
|
|
||||||
// Get everything into tag...
|
|
||||||
$i_indicatorL++;
|
|
||||||
$i_indicatorR = strpos($s_str,'>', $i_indicatorL);
|
|
||||||
$s_temp = substr($s_str, $i_indicatorL, ($i_indicatorR-$i_indicatorL) );
|
|
||||||
$a_tag = explode( ' ', $s_temp );
|
|
||||||
// Here we get the tag's name
|
|
||||||
list( ,$s_tagName,, ) = each($a_tag);
|
|
||||||
$s_tagName = strtoupper($s_tagName);
|
|
||||||
// Well, I am not interesting in <br>, </font> or anything else like that...
|
|
||||||
// So, this is false for tags without options.
|
|
||||||
$b_boolOptions = is_array(($s_tagOption=each($a_tag))) && $s_tagOption[1];
|
|
||||||
if( $b_boolOptions ) {
|
|
||||||
// Without this, we will mess up the array
|
|
||||||
$i_arrayCounter = (int)count($a_html[$s_tagName]);
|
|
||||||
// get the tag options, like src="htt://". Here, s_tagTokOption is 'src' and s_tagTokValue is '"http://"'
|
|
||||||
|
|
||||||
do {
|
|
||||||
$s_tagTokOption = strtoupper(strtok($s_tagOption[1], "="));
|
|
||||||
$s_tagTokValue = trim(strtok("="));
|
|
||||||
$a_html[$s_tagName][$i_arrayCounter][$s_tagTokOption] =
|
|
||||||
$s_tagTokValue;
|
|
||||||
$b_boolOptions = is_array(($s_tagOption=each($a_tag))) &&
|
|
||||||
$s_tagOption[1];
|
|
||||||
} while( $b_boolOptions );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $a_html;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDataEntrepriseRNCS($pageHtml) {
|
|
||||||
|
|
||||||
global $libelleErreur;
|
|
||||||
|
|
||||||
$tabRet=array();
|
|
||||||
|
|
||||||
// Liste et liens vers les Bilans
|
|
||||||
$tabRet['tabListeBilans']=getTabListeBilans($pageHtml);
|
|
||||||
$tabRet['raisonSociale']=getTextInHtml($pageHtml, '<td align="left" valign="top"><span class="boldred"><br>', '<br>', '</span>');
|
|
||||||
$tabRet['RCS']=getTextInHtml($pageHtml, '<span class="textarial">RCS ', 'RCS ', '</span>', true);
|
|
||||||
$tabRet['activite']=getTextInHtml($pageHtml, '<td width="185" align="left" valign="top" bgcolor="#FFFFFF" class="boldtextarial">Activité</td>', 'class="basictext">', '</td>');
|
|
||||||
$tabRet['adresseSiege']=getTextInHtml($pageHtml, '<td align="left" valign="top" bgcolor="#FFFFFF" class="boldtextarial">Siège
|
|
||||||
social</td>', 'class="basictext">', '</td>');
|
|
||||||
print_r($tabRet);
|
|
||||||
die();
|
|
||||||
// Capital social
|
|
||||||
|
|
||||||
// Chiffre d'affaires
|
|
||||||
|
|
||||||
// Date CA
|
|
||||||
|
|
||||||
// Effectif
|
|
||||||
|
|
||||||
// Forme Juridique
|
|
||||||
|
|
||||||
// Nationalité
|
|
||||||
|
|
||||||
// Activité
|
|
||||||
|
|
||||||
// Siège social
|
|
||||||
/*
|
|
||||||
<tr>
|
|
||||||
<td bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
|
|
||||||
<td align="left" valign="top" bgcolor="#FFFFFF" class="boldtextarial">Siège
|
|
||||||
social</td>
|
|
||||||
<td bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
|
|
||||||
|
|
||||||
<td align="left" valign="top" bgcolor="#EBF0F5" class="basictext">75 Avenue la Grande Armee<br>
|
|
||||||
75116 PARIS 16 </td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<div align="center"><img src="../images/degrade580grey.jpg" width="580" height="12"><br>
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
<table width="600" border="0" cellspacing="0" cellpadding="0">
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td align="left" valign="top"><img src="../images/arrowsmallblue.gif" width="9" height="10"><span class="boldtextarialblue15">Renseignements
|
|
||||||
juridiques</span></td>
|
|
||||||
<td> </td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<table width="580" border="0" align="center" cellpadding="1" cellspacing="2">
|
|
||||||
|
|
||||||
|
|
||||||
<tr align="left" valign="top">
|
|
||||||
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
|
|
||||||
|
|
||||||
<td width="185" bgcolor="#FFFFFF" class="boldtextarial">Forme
|
|
||||||
juridique</td>
|
|
||||||
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
|
|
||||||
<td width="385" bgcolor="#EBF0F5" class="basictext">SA à conseil d'administration</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr align="left" valign="top">
|
|
||||||
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
|
|
||||||
<td width="185" bgcolor="#FFFFFF" class="boldtextarial">Capital social</td>
|
|
||||||
|
|
||||||
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
|
|
||||||
<td width="385" bgcolor="#EBF0F5" class="basictext">171.285.000,00
|
|
||||||
EURO</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr align="left" valign="top">
|
|
||||||
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
|
|
||||||
<td width="185" bgcolor="#FFFFFF" class="boldtextarial">Nationalité</td>
|
|
||||||
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
|
|
||||||
<td bgcolor="#EBF0F5" class="basictext">France</td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
<div align="center"><img src="../images/degrade580grey.jpg" width="580" height="12"><br>
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
<div align="center">
|
|
||||||
<table width="588" border="0" cellpadding="0" cellspacing="0">
|
|
||||||
<tr>
|
|
||||||
<td width="210" align="left" valign="top"><img src="../images/arrowsmallblue.gif" width="9" height="10"><span class="boldtextarialblue15">Chiffres
|
|
||||||
clés</span></td>
|
|
||||||
|
|
||||||
<td width="378" align="left" valign="top" class="smalltext">au 31-12-2004</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<table width="580" border="0" align="center" cellpadding="1" cellspacing="2">
|
|
||||||
<tr>
|
|
||||||
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
|
|
||||||
<td width="185" align="left" valign="top" bgcolor="#FFFFFF" class="boldtextarial">Chiffre
|
|
||||||
d'affaires</td>
|
|
||||||
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
|
|
||||||
|
|
||||||
<td width="385" align="left" valign="top" bgcolor="#EBF0F5" class="basictext">18.049.000.000
|
|
||||||
EU</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
|
|
||||||
<td width="185" align="left" valign="top" bgcolor="#FFFFFF" class="boldtextarial">Effectif</td>
|
|
||||||
<td width="5" bgcolor="#336699"><img src="../images/shim.gif" width="2" height="2"></td>
|
|
||||||
<td width="385" align="left" valign="top" bgcolor="#EBF0F5" class="basictext">De 5150 à 5720</td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<div align="center"><img src="../images/degrade580grey.jpg" width="580" height="12"><br>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<table width="600" border="0" cellspacing="2" cellpadding="0">*/
|
|
||||||
return $tabRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDataEcoCoface($pageHtml) {
|
|
||||||
|
|
||||||
global $libelleErreur;
|
|
||||||
|
|
||||||
$tabRet=array();
|
|
||||||
|
|
||||||
// SIREN
|
|
||||||
$pos=strpos($pageHtml, '<b><font class="nota">La forme juridique ou la date de création trop récente de l\'entreprise ne nous permettant pas d\'obtenir suffisamment d\'informations, nous vous offrons ce produit.</font></b>');
|
|
||||||
if ($pos>0) {
|
|
||||||
$tabRet['infoEco']='OUI';
|
|
||||||
$tabRet['societeInactive']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Société inactive</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
|
|
||||||
$strCapital=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Capital   (', '(', '</tr><tr>');
|
|
||||||
$tabTmp=explode('</td>', $strCapital);
|
|
||||||
$tabRet['capital_source']=str_replace(')', '', $tabTmp[0]);
|
|
||||||
$tabTmp=explode(' ', $tabTmp[1]);
|
|
||||||
$tabRet['capital_montant']=str_replace(chr(160), '', trim(strip_tags($tabTmp[0])));
|
|
||||||
$tabRet['capital_devise']=trim(strip_tags($tabTmp[1]));
|
|
||||||
$tabRet['dateCreation']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Date de création</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
|
|
||||||
$tabRet['formeJuridique']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Forme juridique</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
|
|
||||||
$tabRet['cotationBourse']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Cotation en bourse</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
|
|
||||||
$tabRet['effectifSociete']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Effectif société</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
|
|
||||||
$tabRet['activite']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Activité</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
|
|
||||||
|
|
||||||
$tabRet['sigle']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Sigle</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
|
|
||||||
$tabRet['enseigne']=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne" > Enseigne</td>', '<td bgcolor="#FFF3DE" class="tabval" > ', '</td>');
|
|
||||||
|
|
||||||
// Dirigeants
|
|
||||||
$strDir=@getTextInHtml($pageHtml, '<td class="tabtot">IDENTITE</td>', '<td> </td>', '</table>');
|
|
||||||
$tabDir=explode('</tr>', $strDir);
|
|
||||||
$nbDir=1;
|
|
||||||
foreach ($tabDir as $key => $dir)
|
|
||||||
{
|
|
||||||
$tabTmp=explode('<td bgcolor="#FFF3DE" class="tabval" > ', $dir);
|
|
||||||
$typeDir=trim(strip_tags($tabTmp[0]));
|
|
||||||
$nomDir=trim(strip_tags($tabTmp[1]));
|
|
||||||
if ($typeDir<>'' && $typeDir<>'Date de création' && $typeDir<>'Forme juridique' && $typeDir<>'Cotation en bourse'
|
|
||||||
&& $typeDir<>'Effectif société' && $typeDir<>'Société inactive' && $typeDir<>'Activité'
|
|
||||||
&& $typeDir<>'Sigle' && $typeDir<>'Enseigne'
|
|
||||||
&& substr($typeDir, 0, 8) <>'Capital ' )
|
|
||||||
{
|
|
||||||
//$tabDir['Produits'].=$produit.'/';
|
|
||||||
//$produit=str_replace(' ','_',$produit);
|
|
||||||
$tabRet['Dirigeant'.$nbDir.'Type']=trim($typeDir);
|
|
||||||
$tabTmp=explode(' ', $nomDir);
|
|
||||||
$tabRet['Dirigeant'.$nbDir.'Genre']=trim($tabTmp[0]);
|
|
||||||
$tabRet['Dirigeant'.$nbDir.'Prenom']=trim($tabTmp[1]);
|
|
||||||
$tabRet['Dirigeant'.$nbDir.'Nom']=trim($tabTmp[2]);
|
|
||||||
$nbDir++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$tabRet['NbDirigeants']=$nbDir-1;
|
|
||||||
|
|
||||||
// Liens Financiers
|
|
||||||
$strTmp=@getTextInHtml($pageHtml, '<td class="tabtot">LIENS FINANCIERS</td>', '<td> </td>', '</table>');
|
|
||||||
if (strpos($strTmp, 'Néant')>0)
|
|
||||||
$tabRet['LiensFinanciers']='Néant';
|
|
||||||
else
|
|
||||||
$tabRet['LiensFinanciers']='Présence liens';
|
|
||||||
|
|
||||||
// ELEMENTS FINANCIERS
|
|
||||||
$strTmp=@getTextInHtml($pageHtml, '<td class="tabtot">ELEMENTS FINANCIERS</td>', '<td> </td>', '</table>');
|
|
||||||
if (strpos($strTmp, 'Néant')>0)
|
|
||||||
$tabRet['ElementsFinanciers']='Néant';
|
|
||||||
else
|
|
||||||
$tabRet['ElementsFinanciers']='Présence El.Fi.';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$tabRet['infoEco']='NON';
|
|
||||||
|
|
||||||
//echo $pageHtml;
|
|
||||||
//print_r($tabRet);
|
|
||||||
//die();
|
|
||||||
|
|
||||||
return $tabRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getDataEntrepriseCoface($pageHtml) {
|
|
||||||
|
|
||||||
global $libelleErreur;
|
|
||||||
|
|
||||||
$tabRet=array();
|
|
||||||
|
|
||||||
// SIREN
|
|
||||||
$tabRet['siren']=@getTextInHtml($pageHtml, 'portail/entreprise_identite/identite.asp?nsiren=', '?nsiren=', '&IMPRESSION=OUI');
|
|
||||||
//$tabRet['siren']=@getTextInHtml($pageHtml, '<a href="http://www.coface.fr" target="_blank"> Qui sommes nous </a>-<a href="javascript:;" onClick="MM_openBrWindow(\'../mod_cofacescrl/part_recherche.asp?nscrl=18452&metier=ALL&geo=ALL&idnav=168d25840396c5f38f4
|
|
||||||
$tabRet['nscrl']=@getTextInHtml($pageHtml, 'Plan du site </a>-<a href="http://www.coface.fr" target="_blank"> Qui sommes nous </a>-<a href="javascript:;" onClick="MM_openBrWindow(\'../mod_cofacescrl/part_recherche.asp?nscrl=', '?nscrl=', '&metier=ALL&geo=ALL&idnav=');
|
|
||||||
|
|
||||||
// Raison Sociale, Adresse et lien vers Géoloc
|
|
||||||
$strRS_Adr=@getTextInHtml($pageHtml, '<td WIDTH="40%" bgcolor="#F3E5CC" class="tabligne"> <b> Raison sociale<br>', '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval"><b>', '</b></td>');
|
|
||||||
$tabRS_Adr=explode('<br>', $strRS_Adr);
|
|
||||||
$tabRet['raisonSociale']=trim($tabRS_Adr[0]);
|
|
||||||
$tabRS_Adr1=explode(' ', $tabRS_Adr[1]);
|
|
||||||
$tabRet['AdresseLigne1']=trim($tabRS_Adr1[0]);
|
|
||||||
$tabRet['AdresseLigne2']=trim($tabRS_Adr1[1]);
|
|
||||||
$tabRS_Adr1=explode(' ', $tabRS_Adr[2]);
|
|
||||||
$tabRet['codePostal']=trim($tabRS_Adr1[0]);
|
|
||||||
$tabRet['ville']=trim($tabRS_Adr1[1]);
|
|
||||||
$tabRet['UrlGeoLoc']=@getTextInHtml($pageHtml, '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval"><a href="javascript:;" onClick="MM_openBrWindow(\'', 'onClick="MM_openBrWindow(\'', '\',\'Planfax');
|
|
||||||
|
|
||||||
// Téléphone / Fax
|
|
||||||
$strTelFax=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne"><b>Téléphone<br>', '<td bgcolor="#FFF3DE" class="tabval" valign="top">', '</td>');
|
|
||||||
$tabTelFax=explode('<br>', $strTelFax);
|
|
||||||
$tabRet['tel']=trim($tabTelFax[0]);
|
|
||||||
$tabRet['fax']=trim($tabTelFax[1]);
|
|
||||||
|
|
||||||
// Adresse Internet / Email
|
|
||||||
$strInet=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne"><b>Adresse internet <br>', '<td bgcolor="#FFF3DE" class="tabval"><a class="tabval" HREF="', '</a></td>');
|
|
||||||
$tabInet=explode('<br>', $strInet);
|
|
||||||
$tabRet['web']=trim( @getTextInHtml($tabInet[0], ' target="_new">', '>', '</a>') );
|
|
||||||
$tabRet['mail']=trim( @getTextInHtml($tabInet[1], ' href="mailto:', ':', '">') );
|
|
||||||
|
|
||||||
// Bourse
|
|
||||||
$strBourse=@getTextInHtml($pageHtml, '<td bgcolor="#F3E5CC" class="tabligne"> <b>'."\r\n".' Code Sicovam<br>', '<td bgcolor="#FFF3DE" class="tabval">', '</td>');
|
|
||||||
$tabBourse=explode('<br>', $strBourse);
|
|
||||||
$tabRet['bourse_isin']=trim($tabBourse[0]);
|
|
||||||
$tabRet['bourse_marche']=trim($tabBourse[1]);
|
|
||||||
$tabRet['bourse_ville']=trim($tabBourse[2]);
|
|
||||||
|
|
||||||
// Activité
|
|
||||||
$tabRet['activite']=trim(str_replace(' ', ' ', @getTextInHtml($pageHtml, '<td WIDTH="40%" bgcolor="#F3E5CC" class="tabligne" valign="top"><b>Libellé code activité </b></td>', '<td WIDTH="60%" bgcolor="#FFF3DE" class="tabval">', '</td>')));
|
|
||||||
|
|
||||||
// Produits disponibles
|
|
||||||
$strDispos=@getTextInHtml($pageHtml, '<table border="0" cellpadding="0" cellspacing="0" width="98%"><tr><td class="normal"><b>Produits disponibles</b></td></tr><tr><td bgcolor="#E1D0B6"><img src="../images/vide.gif" border="0" height="1"><br></td></tr><tr><td><img src="../images/vide.gif" border="0" height="5"><br></td></tr></table>', '<table border="0" cellpadding="5" cellspacing="0" width="100%">', '</table>');
|
|
||||||
$tabDispos=explode('<td align="left" width="25%"', $strDispos);
|
|
||||||
$tabRet['Produits']='';
|
|
||||||
foreach ($tabDispos as $key => $produit)
|
|
||||||
{
|
|
||||||
$produit=trim(str_replace('>', '', str_replace('nowrap>', '', strip_tags($produit))));
|
|
||||||
if ($produit<>'' && $produit<>' ') {
|
|
||||||
$tabRet['Produits'].=$produit.'/';
|
|
||||||
$produit=str_replace(' ','_',$produit);
|
|
||||||
$tabRet['Produit_'.$produit]='Oui';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// print_r($tabRet);
|
|
||||||
// die();
|
|
||||||
|
|
||||||
return $tabRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getTabListeBilans($pageHtml) {
|
|
||||||
$tabUrl=array();
|
|
||||||
$deb=$fin=0;
|
|
||||||
while( is_int(($deb=strpos($pageHtml,'<a href="http://www.societe.com/cgi-bin/bilan?bil=',$fin))) ) {
|
|
||||||
$deb=$deb+9;
|
|
||||||
$fin = strpos($pageHtml,'</a>', $deb);
|
|
||||||
$s_temp = substr($pageHtml, $deb, ($fin-$deb));
|
|
||||||
//echo $s_temp."\r\n";
|
|
||||||
$a_temp = explode('" class="basic">', $s_temp);
|
|
||||||
$tabUrl[$a_temp[1]]=$a_temp[0];
|
|
||||||
}
|
|
||||||
return $tabUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTabListeGU($pageHtml) {
|
|
||||||
$tabGU=array();
|
|
||||||
$deb=$fin=0;
|
|
||||||
/* <tr><td><img alt="" src="b.gi onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class=txt9px href="javascript:ChoixGeo('CP_PDR_SUP_LOC_REQ')">Lancer la recherche dans toute la localité</td></tr>
|
|
||||||
<tr><td><img src="b.gif" alt="" border=0></td><td align="left" onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class=txt9px href="javascript:ChoixGeo('CP_INSCRIPTIONS_REQ')">Lancer la recherche sans l'adresse</td></tr>
|
|
||||||
*/
|
|
||||||
while( is_int(($deb=strpos($pageHtml,'<td onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class="txt9px" href="javascript:ChoixGeo(\'',$fin))) ) {
|
|
||||||
$deb=$deb+122;
|
|
||||||
$fin = strpos($pageHtml,'</td></tr>', $deb);
|
|
||||||
$s_temp = substr($pageHtml, $deb, ($fin-$deb));
|
|
||||||
//echo $s_temp."\r\n";
|
|
||||||
$a_temp = explode('\')">', $s_temp);
|
|
||||||
$tabGU[$a_temp[1]]=$a_temp[0];
|
|
||||||
}
|
|
||||||
return $tabGU;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTabListeNonTrouve($pageHtml) {
|
|
||||||
$tabGU=array();
|
|
||||||
$deb=$fin=0;
|
|
||||||
/* onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class=txt9px href="javascript:ChoixGeo('CP_PDR_SUP_LOC_REQ')">Lancer la recherche dans toute la localité</td></tr>
|
|
||||||
onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class=txt9px href="javascript:ChoixGeo('CP_INSCRIPTIONS_REQ')">Lancer la recherche sans l'adresse</td></tr>
|
|
||||||
*/
|
|
||||||
while( is_int(($deb=strpos($pageHtml,'onMouseOver="javascript:mOvr(this);" onMouseOut="javascript:mOut(this);"><a class=txt9px href="javascript:ChoixGeo(\'',$fin))) ) {
|
|
||||||
$deb=$deb+116;
|
|
||||||
$fin = strpos($pageHtml,'</td></tr>', $deb);
|
|
||||||
$s_temp = substr($pageHtml, $deb, ($fin-$deb));
|
|
||||||
//echo $s_temp."\r\n";
|
|
||||||
$a_temp = explode('\')">', $s_temp);
|
|
||||||
$tabGU[$a_temp[1]]=$a_temp[0];
|
|
||||||
}
|
|
||||||
return $tabGU;
|
|
||||||
}
|
|
||||||
/** Recherche un texte dans une page HTML
|
|
||||||
**
|
|
||||||
**/
|
|
||||||
function getTextInHtml($pageHtml, $strToFind, $strDeb, $strEnd, $include_strDeb=false, $include_strEnd=false, $ltrim=true, $rtrim=true, &$fin, $nbOcc=1) {
|
|
||||||
$tabRet=array();
|
|
||||||
$deb=$nbOccTrouve=0;
|
|
||||||
while( is_int(($deb=strpos($pageHtml,$strToFind,$fin))) ) {
|
|
||||||
$deb++;
|
|
||||||
$deb2 = strpos($pageHtml,$strDeb, $deb);
|
|
||||||
$fin = strpos($pageHtml,$strEnd, $deb2);
|
|
||||||
if (!$include_strDeb)
|
|
||||||
$deb2+=strlen($strDeb);
|
|
||||||
$s_temp = substr($pageHtml, $deb2, ($fin-$deb2));
|
|
||||||
|
|
||||||
if ($ltrim) $s_temp=ltrim($s_temp);
|
|
||||||
if ($rtrim) $s_temp=rtrim($s_temp);
|
|
||||||
|
|
||||||
if ($nbOcc==1) return $s_temp;
|
|
||||||
//echo $s_temp."\r\n";
|
|
||||||
//$a_temp = explode('" class="basic">', $s_temp);
|
|
||||||
$tabUrl[$nbOccTrouve]=$s_temp;
|
|
||||||
$nbOccTrouve++;
|
|
||||||
|
|
||||||
if ($nbOcc==$nbOccTrouve) {
|
|
||||||
// echo "j'ai trouvé le nb demandé, je sort\r\n";
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return $tabUrl;
|
|
||||||
/*<span class="mongrasvert">
|
|
||||||
<li>Le type de voie a été modifié<br>
|
|
||||||
<li>L'orthographe du mot directeur a été modifiée<br>
|
|
||||||
<li>Le code postal a été forcé à partir du département et de la localité<br> </span>
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
?>
|
|
@ -1,89 +0,0 @@
|
|||||||
<?
|
|
||||||
//include('fonctions.php');
|
|
||||||
//include('insee.class.php');
|
|
||||||
define('HOST_NORMAD', 'www.normad.fr');
|
|
||||||
define('SITE_NORMAD', 'http://'. HOST_NORMAD .'/');
|
|
||||||
|
|
||||||
//$normad2=new Normad('SCI BRYGE', 'Kervegant', '', '', '', '29', 'SCAER');
|
|
||||||
|
|
||||||
class Normad {
|
|
||||||
/** Normalise l'adresse postale donnée en paramètre. Seule la ligne 1 qui devrait comporter la Raison Sociale ou le nom de l'expéditeur reste inchangée !
|
|
||||||
** @param $adrL1 Obligatoirement le Nom ou la Raison Sociale du destinataire
|
|
||||||
** @param $adrL2 Normalisation = Appart.,Bâtiment...
|
|
||||||
** @param $adrL3 Normalisation = Résidence,Cité...
|
|
||||||
** @param $adrL4 Normalisation = Num./Bis/Type voie/Nom voie
|
|
||||||
** @param $adrL5 Normalisation = BP,TSA,Lieu-dit...
|
|
||||||
** @param $codPos Code Postal (ou département)
|
|
||||||
** @param $ville Ville (orthographe correcte si possible si pas de CP)
|
|
||||||
** @return array
|
|
||||||
**/
|
|
||||||
function Normad ($adrL1, $adrL2, $adrL3, $adrL4, $adrL5, $codPos, $ville) {
|
|
||||||
$adrL1 =substr(trim($adrL1) , 0, 40);
|
|
||||||
$adrL2 =substr(trim($adrL2) , 0, 40);
|
|
||||||
$adrL3 =substr(trim($adrL3) , 0, 40);
|
|
||||||
$adrL4 =substr(trim($adrL4) , 0, 40);
|
|
||||||
$adrL5 =substr(trim($adrL5) , 0, 40);
|
|
||||||
$codPos=substr(trim($codPos), 0, 5);
|
|
||||||
$ville =substr(trim($ville) , 0, 33);
|
|
||||||
$postData=array( 'ad1'=>$adrL2, //htmlentities($adrL2),
|
|
||||||
'ad2'=>$adrL3, //htmlentities($adrL3),
|
|
||||||
'ad3'=>$adrL4, //htmlentities($adrL4),
|
|
||||||
'ad4'=>$adrL5, //htmlentities($adrL5),
|
|
||||||
'cod'=>$codPos,
|
|
||||||
'loc'=>htmlentities($ville),
|
|
||||||
'hiddenField'=>'GEN',);
|
|
||||||
$tabHtml=getUrl(SITE_NORMAD.'traiter_adresse.php', '', $postData, SITE_NORMAD.'validez.php', true, HOST_NORMAD);
|
|
||||||
$page=$tabHtml['body'];
|
|
||||||
$posInHtml=0;
|
|
||||||
$tabRet=array();
|
|
||||||
|
|
||||||
$retour=trim(str_replace(chr(173), '', getTextInHtml($page, '<td colspan=2><font face="Arial" size="2" color="#3F5A80"><b>', '<b>', '</b></font>', false, true, true, true, $posInHtml)));
|
|
||||||
$retour=explode('[*', $retour);
|
|
||||||
$tabRet['retour_code']=str_replace(']','',$retour[1]);
|
|
||||||
$tabRet['retour_libelle']=trim($retour[0]);
|
|
||||||
$tabRet['retour_messages']=getTextInHtml($page, '<li>', 'i>', '<br>', false, false, true, true, $posInHtml, 0);
|
|
||||||
|
|
||||||
// Récupération des Lignes d'adresse
|
|
||||||
$tabRet['ligne1']=$adrL1;
|
|
||||||
$tabRet['ligne2']=getTextInHtml($page, '<td class="gris2"><span class=grasnoir>Adresse en sortie :</span>', '<td class=gras nowrap>', '</td>', false, false, true, true, $posInHtml);
|
|
||||||
$tabRet['ligne3']=getTextInHtml($page, '<td class=pet align=right nowrap> Volet 2 : </td>', '<td class=gras nowrap>', '</td>', false, false, true, true, $posInHtml);
|
|
||||||
$tabRet['ligne4']=getTextInHtml($page, '<td class=pet align=right nowrap> Volet ', '<td class=gras nowrap>', '</td>', false, false, true, true, $posInHtml);
|
|
||||||
$tabRet['ligne5']=getTextInHtml($page, '<td class=pet align=right nowrap> Volet 4 : </td>', '<td class=gras nowrap>', '</td>', false, false, true, true, $posInHtml);
|
|
||||||
$tabRet['CP']=getTextInHtml($page, '<td class=pet align=right nowrap> CP : </td>', '<td class=gras nowrap>', '</td>', false, false, true, true, $posInHtml);
|
|
||||||
$tabRet['ville']=getTextInHtml($page, '<td class=pet align=right nowrap> Localité : </td>', '<td class=gras nowrap>', '</td>', false, false, true, true, $posInHtml);
|
|
||||||
$tabRet['ligne6']=$tabRet['CP'] .' '. $tabRet['ville'];
|
|
||||||
|
|
||||||
// Découpage de la rue
|
|
||||||
$tabRet['voie_num']=getTextInHtml($page, '<span class=pet>Numéro ', '<span class=gras>', '</span><br>', false, false, true, true, $posInHtml);
|
|
||||||
$tabRet['voie_btq']=getTextInHtml($page, '<span class=pet>Bis/Ter/Quater/...', '<span class=gras>', '</span><br>', false, false, true, true, $posInHtml);
|
|
||||||
$tabRet['voie_type']=getTextInHtml($page, '<span class=pet>Type', '<span class=gras>', '</span><br>', false, false, true, true, $posInHtml);
|
|
||||||
$tabRet['voie_denom']=getTextInHtml($page, '<span class=pet>Dénomination', '<span class=gras>', '</span><br>', false, false, true, true, $posInHtml);
|
|
||||||
$tabRet['voie_motDir']=getTextInHtml($page, 'directeur :</span> ', '<span class=gras>', '</span><br>', false, false, true, true, $posInHtml);
|
|
||||||
$tabRet['voie_matric']=getTextInHtml($page, '<span class=pet>Matricule voie :</span>', '</span>', '<br>', false, true, true, true, $posInHtml);
|
|
||||||
$tabRet['code_insee_commune']=getTextInHtml($page, '<span class=pet>Code INSEE commune :</span>', '</span>', '<br>', false, true, true, true, $posInHtml);
|
|
||||||
|
|
||||||
print_r($tabRet);
|
|
||||||
//echo "$voie_num\r\n$voie_btq\r\n$voie_type\r\n$voie_denom\r\n$voie_motDir\r\n$voie_matric\r\n$code_insee_commune\r\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
<td class="gris2" valign=top><span class=grasnoir>Détails :</span><br>
|
|
||||||
|
|
||||||
00441644 <br>
|
|
||||||
|
|
||||||
28074 <br>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<hr size=1>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan=3><p class="gris2" align="justify"> </p>
|
|
||||||
<p class="mongrasvert" align="right"> Référentiels
|
|
||||||
d'avril 2006 </p>
|
|
||||||
*/
|
|
||||||
|
|
||||||
} ?>
|
|
@ -1,170 +0,0 @@
|
|||||||
<?PHP
|
|
||||||
|
|
||||||
$this->tabNotation['A+']=array('Exceptionnel', 'A3++', 'Aaa' ,'AAA' ,'0.001');
|
|
||||||
$this->tabNotation['A'] =array('Excellent', 'A3+', 'Aa1 Aa2 Aa3' ,'AA+ AA AA-' ,'0.01');
|
|
||||||
$this->tabNotation['B+']=array('Très bon', '3++', 'A1' ,'A+' ,'0.02');
|
|
||||||
$this->tabNotation['B'] =array('Bon', '3+', 'A2 A3' ,'A A-' ,'0.04');
|
|
||||||
$this->tabNotation['C+']=array('Assez bon', '3', 'Baa1' ,'BBB+' ,'0.15');
|
|
||||||
$this->tabNotation['C'] =array('Acceptable', '3', 'Baa2' ,'BBB' ,'0.30');
|
|
||||||
$this->tabNotation['C-']=array('Moyen', '3', 'Baa3' ,'BBB-' ,'0.60');
|
|
||||||
$this->tabNotation['D+']=array('Passable', '4+', 'Ba1' ,'BB+' ,'0.90');
|
|
||||||
$this->tabNotation['D'] =array('Médiocre', '4', 'Ba2' ,'BB' ,'1.25');
|
|
||||||
$this->tabNotation['D-']=array('Très médiocre', '4', 'Ba3' ,'BB-' ,'1.60');
|
|
||||||
$this->tabNotation['E+']=array('Mauvais (sous surveillance)', '5', 'B1 B2 B3', 'B+ B B-', '5.00');
|
|
||||||
$this->tabNotation['E'] =array('Très mauvais (sensible, sans incident)', '6', 'Caa', 'CCC', '14.00');
|
|
||||||
$this->tabNotation['E-']=array('Très mauvais (sensible avec incidents)', '8', 'Ca C', 'CC C', '17.00');
|
|
||||||
$this->tabNotation['F'] =array('En défaut, hors procédures judiciaires (douteux)', '8 9', 'D', 'D', 'Défaut');
|
|
||||||
$this->tabNotation['Z'] =array('En défaut, avec procédures judiciaires ou contentieuses (douteux)', 'P', '', '', 'Défaut');
|
|
||||||
|
|
||||||
$this->tabLibActivite[0]='';
|
|
||||||
$this->tabLibActivite[15]='Industries Alimentaires : Collecte Appro';
|
|
||||||
$this->tabLibActivite[3]='Industries Alimentaires : Collecte et 1ère transformation';
|
|
||||||
$this->tabLibActivite[5]='Industries Alimentaires : Eaux de vie et Champagne';
|
|
||||||
$this->tabLibActivite[2]='Industries Alimentaires : Autres activités';
|
|
||||||
$this->tabLibActivite[6]='Industries extractives / Production Distribution : Énergie Eau';
|
|
||||||
$this->tabLibActivite[7]='Construction - BTP';
|
|
||||||
$this->tabLibActivite[1]='Industries Manufacturières';
|
|
||||||
$this->tabLibActivite[8]='Négoce';
|
|
||||||
$this->tabLibActivite[4]='Commerce de Gros';
|
|
||||||
$this->tabLibActivite[9]='Commerce Distribution';
|
|
||||||
$this->tabLibActivite[10]='Grande Distribution';
|
|
||||||
$this->tabLibActivite[12]='Transports';
|
|
||||||
$this->tabLibActivite[13]='Media Technologie de l\'information';
|
|
||||||
$this->tabLibActivite[14]='Services';
|
|
||||||
$this->tabLibActivite[11]='Hôtellerie et Loisirs / Activités immobilières';
|
|
||||||
$this->tabLibActivite[16]='Banques. Assurances. Activités financières';
|
|
||||||
$this->tabLibActivite[17]='Agriculture. Sylviculture. Pêche. Aquaculture';
|
|
||||||
|
|
||||||
$this->tabActivite[15]=array('512A');
|
|
||||||
$this->tabActivite[3]=array('151A','151C','152','153E','155','157','159G','159J','159N','159Q');
|
|
||||||
$this->tabActivite[5]=array('159A','159F');
|
|
||||||
$this->tabActivite[2]=array('151E','151F','153A','153C','153F','154','156','158','159B','159D','159L','159S','159T');
|
|
||||||
$this->tabActivite[6]=array('11','10','12','13','14','401','402','403','410');
|
|
||||||
$this->tabActivite[7]=array('451','452','453','454','455');
|
|
||||||
$this->tabActivite[1]=array('251','252','241','242','243','245','246','247','261','262','263','264','265','266','267','268','244','297','300','311','312','313','314','315','316','321','322','323','17','18','19','20','21','271','272','273','274','275','281','282','283','284','285','286','287','291','292','293','294','295','296','341','342','343','353','351','352','354','355','223','331','332','333','334','335','361','362','363','364','365','366','231','232','233','222','371','372');
|
|
||||||
$this->tabActivite[8]=array();
|
|
||||||
$this->tabActivite[4]=array('511A','511N','511P','512C','512E','512G','512J','513','511C','515A','515C','511E','511G','511J','511L','511R','511T','511U','514','515E','515F','515H','515J','515L','515N','515Q','516','517');
|
|
||||||
$this->tabActivite[9]=array('501','502','503','504','505','521A','521B','521C','521J','522','523','524A','524C','524E','524F','524H','524J','524L','524N','524R','524T','524U','524V','524W','524X','524Y','524Z','525','526');
|
|
||||||
$this->tabActivite[10]=array('521D','521E','521F','521H','524P');
|
|
||||||
$this->tabActivite[12]=array('621','622','623','611','612','602','603','631','632','634','634B','634C','634A','641');
|
|
||||||
$this->tabActivite[13]=array('221','722','721','723','724','725','726','924','642','922','921');
|
|
||||||
$this->tabActivite[14]=array('703','712E','711','712A','713','714','712C','741A','741C','741E','741G','742','743','741J','744','745','746','747','748','900','633','801','802','803','804','851','852','853','930','911','912','913','527','950');
|
|
||||||
$this->tabActivite[11]=array('923','925','926','927','551','552','553','554','555','702');
|
|
||||||
$this->tabActivite[16]=array('651','660','672','652E','652A','652C','652F','671');
|
|
||||||
$this->tabActivite[17]=array('751','990','752','990','701');
|
|
||||||
|
|
||||||
$this->tabR[1][0]=array();
|
|
||||||
$this->tabR[1][1]=array('0:15.5','15.5:21.7','21.7:25','25:29.1','29.1:33.4','33.4:37','37:40','40:42.6','42.6:44.9','44.9:100');
|
|
||||||
$this->tabR[1][2]=array('0:18.7','18.7:22.8','22.8:25','25:27.7','27.7:30.6','30.6:33','33:35','35:36.7','36.7:38.3','38.3:100');
|
|
||||||
$this->tabR[1][3]=array('0:18.7','18.7:22.8','22.8:25','25:27.7','27.7:30.6','30.6:33','33:35','35:36.7','36.7:38.3','38.3:100');
|
|
||||||
$this->tabR[1][4]=array('0:8.7','8.7:12.8','12.8:15','15:17.7','17.7:20.6','20.6:23','23:25','25:26.7','26.7:28.3','28.3:100');
|
|
||||||
$this->tabR[1][5]=array('0:18.7','18.7:22.8','22.8:25','25:27.7','27.7:30.6','30.6:33','33:35','35:36.7','36.7:38.3','38.3:100');
|
|
||||||
$this->tabR[1][6]=array('0:20.5','20.5:26.7','26.7:30','30:34.1','34.1:38.4','38.4:42','42:45','45:47.6','47.6:49.9','49.9:100');
|
|
||||||
$this->tabR[1][7]=array('0:13.7','13.7:17.8','17.8:20','20:22.7','22.7:25.6','25.6:28','28:30','30:31.7','31.7:33.3','33.3:100');
|
|
||||||
$this->tabR[1][8]=array('0:3.7','3.7:7.8','7.8:10','10:12.7','12.7:15.6','15.6:18','18:20','20:21.7','21.7:23.3','23.3:100');
|
|
||||||
$this->tabR[1][9]=array('0:13.7','13.7:17.8','17.8:20','20:22.7','22.7:25.6','25.6:28','28:30','30:31.7','31.7:33.3','33.3:100');
|
|
||||||
$this->tabR[1][10]=array('0:5.7','5.7:9.8','9.8:12','12:14.7','14.7:17.6','17.6:20','20:22','22:23.7','23.7:25.3','25.3:100');
|
|
||||||
$this->tabR[1][11]=array('0:18.7','18.7:22.8','22.8:25','25:27.7','27.7:30.6','30.6:33','33:35','35:36.7','36.7:38.3','38.3:100');
|
|
||||||
$this->tabR[1][12]=array('0:13.7','13.7:17.8','17.8:20','20:22.7','22.7:25.6','25.6:28','28:30','30:31.7','31.7:33.3','33.3:100');
|
|
||||||
$this->tabR[1][13]=array('0:23.7','23.7:27.8','27.8:30','30:32.7','32.7:35.6','35.6:38','38:40','40:41.7','41.7:43.3','43.3:100');
|
|
||||||
$this->tabR[1][14]=array('0:18.7','18.7:22.8','22.8:25','25:27.7','27.7:30.6','30.6:33','33:35','35:36.7','36.7:38.3','38.3:100');
|
|
||||||
$this->tabR[1][15]=array('0:15.5','15.5:21.7','21.7:25','25:29.1','29.1:33.4','33.4:37','37:40','40:42.6','42.6:44.9','44.9:100');
|
|
||||||
$this->tabR[1][16]=array('0:6.8','6.8:8.9','8.9:10','10:11.4','11.4:12.8','12.8:14','14:15','15:15.9','15.9:16.6','16.6:100');
|
|
||||||
$this->tabR[1][17]=array('0:18.7','18.7:22.8','22.8:25','25:27.7','27.7:30.6','30.6:33','33:35','35:36.7','36.7:38.3','38.3:100');
|
|
||||||
|
|
||||||
$this->tabR[2][0]=array();
|
|
||||||
$this->tabR[2][1]=array('1.8:','1.6:1.8','1.5:1.6','1.4:1,5','1.2:1.4','1.0:1.2','0.9:1.0','0.8:0,9','0.7:0,8','0:0.7');
|
|
||||||
$this->tabR[2][2]=array('2.2:','1.9:2.2','1.8:1.9','1.6:1.8','1.4:1.6','1.2:1.4','1.0:1.2','0.9:1.0','0.7:0.9','0:0.7');
|
|
||||||
$this->tabR[2][3]=array('2.2:','1.9:2.2','1.8:1.9','1.6:1.8','1.4:1.6','1.2:1.4','1.0:1.2','0.9:1.0','0.7:0.9','0:0.7');
|
|
||||||
$this->tabR[2][4]=array('3.0:','2.7:3.0','2.5:2.7','2.3:2.5','2.0:2.3','1.7:2.0','1.5:1.7','1.3:1.5','1.1:1.3','0:1.1');
|
|
||||||
$this->tabR[2][5]=array('2.6:','2.4:2.6','2.2:2.4','2.0:2.2','1.7:2.0','1.5:1.7','1.3:1.5','1.1:1.3','1.0:1.1','0:1');
|
|
||||||
$this->tabR[2][6]=array('1.7:','1.6:1.7','1.5:1.6','1.4:1.5','1.2:1.4','1.1:1.2','1.0:1.1','0.9:1.0','0.8:0.9','0:0.8');
|
|
||||||
$this->tabR[2][7]=array('1.5:','1.4:1.5','1.3:1.4','1.1:1.3','1.0:1.2','0.9:1.0','0.8:0.9','0.7:0.8','0.6:0.7','0:0.6');
|
|
||||||
$this->tabR[2][8]=array('10.1:','8.8:10.1','8:8.8','7:8','5.8:7','4.8:5.8','4:4.8','3.3:4','2.8:3.3','0:2.8');
|
|
||||||
$this->tabR[2][9]=array('3:','2.7:3','2.5:2.7','2.3:2.5','2:2.3','1.7:2','1.5:1.7','1.3:1.5','1.1:1.3','0:1.1');
|
|
||||||
$this->tabR[2][10]=array('3.8:','3.3:3.8','3.0:3.3','2.6:3.0','2.2:2.6','1.8:2.2','1.5:1.8','1.2:1.5','1.0:1.2','0:1');
|
|
||||||
$this->tabR[2][11]=array('2.3:','2.1:2.3','2:2.1','1.8:2','1.6:1.8','1.5:1.6','1.3:1.5','1.2:1.3','1:1.2','0:1');
|
|
||||||
$this->tabR[2][12]=array('2.3:','2.1:2.3','2:2.1','1.8:2','1.6:1.8','1.5:1.6','1.3:1.5','1.2:1.3','1:1.2','0:1');
|
|
||||||
$this->tabR[2][13]=array('1.8:','1.6:1.8','1.5:1.6','1.4:1.5','1.2:1.4','1:1.2','0.9:1','0.8:0.9','0.7:0.8','0:0.7');
|
|
||||||
$this->tabR[2][14]=array('1.8:','1.6:1.8','1.5:1.6','1.4:1.5','1.2:1.4','1:1.2','0.9:1','0.8:0.9','0.7:0.8','0:0.7');
|
|
||||||
$this->tabR[2][15]=array('2.2:','1.9:2.2','1.7:1.9','1.5:1.7','1.2:1.5','1.0:1.2','0.8:1.0','0.7:0.8','0.5:0.7','0:0.5');
|
|
||||||
$this->tabR[2][16]=array('10.1:','8.8:10.1','8:8.8','7:8','5.8:7','4.8:5.8','4:4.8','3.3:4','2.8:3.3','0:2.8');
|
|
||||||
$this->tabR[2][17]=array('2.2:','1.9:2.2','1.8:1.9','1.6:1.8','1.4:1.6','1.2:1.4','1:1.2','0.9:1','0.7:0.9','0:0.7');
|
|
||||||
|
|
||||||
$this->tabR[3][0]=array();
|
|
||||||
$this->tabR[3][1]=array('4.4:','4:4.4','3.8:4','3.5:3.8','3.1:3.5','2.8:3.1','2.5:2.8','2.2:2.5','2:2.2','0:2');
|
|
||||||
$this->tabR[3][2]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
|
|
||||||
$this->tabR[3][3]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
|
|
||||||
$this->tabR[3][4]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
|
|
||||||
$this->tabR[3][5]=array('8.6:','7.9:8.6','7.5:7.9','6.9:7.5','6.2:6.9','5.6:6.2','5:5.6','4.5:5','4:4.5','0:4');
|
|
||||||
$this->tabR[3][6]=array('4.4:','4:4.4','3.8:4','3.5:3.8','3.1:3.5','2.8:3.1','2.5:2.8','2.2:2.5','2:2.2','0:2');
|
|
||||||
$this->tabR[3][7]=array('4.4:','4:4.4','3.8:4','3.5:3.8','3.1:3.5','2.8:3.1','2.5:2.8','2.2:2.5','2:2.2','0:2');
|
|
||||||
$this->tabR[3][8]=array('10.9:','9.7:10.9','9:9.7','8:9','6.8:8','5.8:6.8','5:5.8','4.3:5','3.7:4.3','0:3.7');
|
|
||||||
$this->tabR[3][9]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
|
|
||||||
$this->tabR[3][10]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
|
|
||||||
$this->tabR[3][11]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
|
|
||||||
$this->tabR[3][12]=array('5.9:','5.4:5.9','5:5.4','4.5:5','3.9:4.5','3.4:3.9','3:3.4','2.6:3','2.3:2.6','0:2.3');
|
|
||||||
$this->tabR[3][13]=array('4.2:','3.8:4.2','3.5:3.8','3.1:3.5','2.7:3.1','2.3:2.7','2:2.3','1.7:2','1.5:1.7','0:1.5');
|
|
||||||
$this->tabR[3][14]=array('4.2:','3.8:4.2','3.5:3.8','3.1:3.5','2.7:3.1','2.3:2.7','2:2.3','1.7:2','1.5:1.7','0:1.5');
|
|
||||||
$this->tabR[3][15]=array('6.9:','6.3:6.9','6.0:6.3','5.5:6.0','5.0:5.5','4.5:5.0','4.0:4.5','3.6:4.0','3.2:3.6','0:3.2');
|
|
||||||
$this->tabR[3][16]=array('10.9:','9.7:10.9','9:9.7','8:9','6.8:8','5.8:6.8','5:5.8','4.3:5','3.7:4.3','0:3.7');
|
|
||||||
$this->tabR[3][17]=array('5.2:','4.7:5.2','4.5:4.7','4.1:4.5','3.7:4.1','3.3:3.7','3:3.3','2.7:3','2.4:2.7','0:2.4');
|
|
||||||
|
|
||||||
$this->tabR[4][0]=array();
|
|
||||||
$this->tabR[4][1]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
|
|
||||||
$this->tabR[4][2]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
|
|
||||||
$this->tabR[4][3]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
|
|
||||||
$this->tabR[4][4]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
|
|
||||||
$this->tabR[4][5]=array('0:1.36','1.36:1.44','1.44:1.5','1.5:1.58','1.58:1.71','1.71:1.85','1.85:2','2:2.16','2.16:2.33','2.33:');
|
|
||||||
$this->tabR[4][6]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
|
|
||||||
$this->tabR[4][7]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
|
|
||||||
$this->tabR[4][8]=array('0:1.1','1.1:1.2','1.2:1.3','1.3:1.4','1.4:1.6','1.6:1.8','1.8:2','2:2.2','2.2:2.5','2.5:');
|
|
||||||
$this->tabR[4][9]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
|
|
||||||
$this->tabR[4][10]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
|
|
||||||
$this->tabR[4][11]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
|
|
||||||
$this->tabR[4][12]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
|
|
||||||
$this->tabR[4][13]=array('0:2.4','2.4:2.7','2.7:3','3:3.4','3.4:4.1','4.1:5','5:6','6:7.2','7.2:8.7','8.7:');
|
|
||||||
$this->tabR[4][14]=array('0:2.4','2.4:2.7','2.7:3','3:3.4','3.4:4.1','4.1:5','5:6','6:7.2','7.2:8.7','8.7:');
|
|
||||||
$this->tabR[4][15]=array('0:2.9','2.9:3.4','3.4:3.7','3.7:4.3','4.3:5.2','5.2:6.2','6.2:7.5','7.5:9.1','9.1:10.9','10.9:');
|
|
||||||
$this->tabR[4][16]=array('0:1.1','1.1:1.2','1.2:1.3','1.3:1.4','1.4:1.6','1.6:1.8','1.8:2','2:2.2','2.2:2.5','2.5:');
|
|
||||||
$this->tabR[4][17]=array('0:2','2:2.3','2.3:2.5','2.5:2.9','2.9:3.5','3.5:4.2','4.2:5','5:6','6:7.2','7.2:');
|
|
||||||
|
|
||||||
$this->tabR[5][0]=array();
|
|
||||||
$this->tabR[5][1]=array('-99:-40','-40:-34','-34:-30','-30:-24','-24:-16','-16:-8','-8:0','0:8.1','8.1:16.1','16.1:');
|
|
||||||
$this->tabR[5][2]=array('-99:-40','-40:-34','-34:-30','-30:-24','-24:-16','-16:-8','-8:0','0:8.1','8.1:16.1','16.1:');
|
|
||||||
$this->tabR[5][3]=array('-99:-40','-40:-34','-34:-30','-30:-24','-24:-16','-16:-8','-8:0','0:8.1','8.1:16.1','16.1:');
|
|
||||||
$this->tabR[5][4]=array('-99:-16.7','-16.7:-12.7','-12.7:-10','-10:-6','-6:-0.7','-0.7:4.7','4.7:10','10:15.3','15.3:20.7','20.7:');
|
|
||||||
$this->tabR[5][5]=array('-999:-420','-420:-384','-384:-360','-360:-324','-324:-276','-276:-228','-228:-180','-180:-132','-132:-84','-84:');
|
|
||||||
$this->tabR[5][6]=array('-99:-40','-40:-34','-34:-30','-30:-24','-24:-16','-16:-8','-8:0','0:8.1','8.1:16.1','16.1:');
|
|
||||||
$this->tabR[5][7]=array('-99:-30','-30:-24','-24:-20','-20:-14','-14:-6','-6:2','2:10','10:18','18:26','26:');
|
|
||||||
$this->tabR[5][8]=array('-99:-41.7','-41.7:-34.7','-34.7:-30','-30:-23','-23:-13.7','-13.7:-4.3','-4.3:5','5:14.3','14.3:23.7','23.7:');
|
|
||||||
$this->tabR[5][9]=array('-99:-16.7','-16.7:-12.7','-12.7:-10','-10:-6','-6:-0.7','-0.7:4.7','4.7:10','10:15.3','15.3:20.7','20.7:');
|
|
||||||
$this->tabR[5][10]=array('-99:-5','-5:-2','-2:0','0:3','3:7','7:11','11:15','15:19','19:23','23:');
|
|
||||||
$this->tabR[5][11]=array('-99:-6.7','-6.7:-2.7','-2.7:0','0:4','4:9.3','9.3:14.7','14.7:20','20:25.3','25.3:30.7','30.7:');
|
|
||||||
$this->tabR[5][12]=array('-99:-6.7','-6.7:-2.7','-2.7:0','0:4','4:9.3','9.3:14.7','14.7:20','20:25.3','25.3:30.7','30.7:');
|
|
||||||
$this->tabR[5][13]=array('-99:-6.7','-6.7:-2.7','-2.7:0','0:4','4:9.3','9.3:14.7','14.7:20','20:25.3','25.3:30.7','30.7:');
|
|
||||||
$this->tabR[5][14]=array('-99:-6.7','-6.7:-2.7','-2.7:0','0:4','4:9.3','9.3:14.7','14.7:20','20:25.3','25.3:30.7','30.7:');
|
|
||||||
$this->tabR[5][15]=array('-99:-38.3','-38.3:-36.3','-36.3:-35.0','-35:-33','-33.0:-30','-30:-27.7','-27.7:-25.0','-25.0:-22.3','-22.3:-19.7','-19.7:');
|
|
||||||
$this->tabR[5][16]=array('-99:-41.7','-41.7:-34.7','-34.7:-30','-30:-23','-23:-13.7','-13.7:-4.3','-4.3:5','5:14.3','14.3:23.7','23.7:');
|
|
||||||
$this->tabR[5][17]=array(':-58.3','-58.3:53.3','-53.3:-50','-50:-45','-45:-38.3','-38.3:-31.7','-31.7:-25','-25:-18.3','-18.3:-11.7','-11.7:');
|
|
||||||
|
|
||||||
$this->tabR[6][0]=array();
|
|
||||||
$this->tabR[6][1]=array('0:6','6:6.6','6.6:7','7:7.6','7.6:8.4','8.4:9.2','9.2:10','10:10.8','10.8:11.6','11.6:');
|
|
||||||
$this->tabR[6][2]=array('0:6','6:6.6','6.6:7','7:7.6','7.6:8.4','8.4:9.2','9.2:10','10:10.8','10.8:11.6','11.6:');
|
|
||||||
$this->tabR[6][3]=array('0:1.5','1.5:2.1','2.1:2.5','2.5:3.1','3.1:3.9','3.9:4.7','4.7:5.5','5.5:6.3','6.3:7.1','7.1:');
|
|
||||||
$this->tabR[6][4]=array('0:1.8','1.8:2.2','2.2:2.5','2.5:2.9','2.9:3.4','3.4:4','4:4.5','4.5:5','5:5.6','5.6:');
|
|
||||||
$this->tabR[6][5]=array('0:6.7','6.7:7.5','7.5:8','8:8.8','8.8:9.9','9.9:10.9','10.9:12','12:13.1','13.1:14.1','14.1:');
|
|
||||||
$this->tabR[6][6]=array('0:7.7','7.7:8.5','8.5:9','9:9.8','9.8:10.9','10.9:11.9','11.9:13','13:14.1','14.1:15.1','15.1:');
|
|
||||||
$this->tabR[6][7]=array('0:3','3:3.6','3.6:4','4:4.6','4.6:5.4','5.4:6.2','6.2:7','7:7.8','7.8:8.6','8.6:');
|
|
||||||
$this->tabR[6][8]=array('0:1.3','1.3:1.7','1.7:2','2:2.4','2.4:2.9','2.9:3.5','3.5:4','4:4.5','4.5:5.1','5.1:');
|
|
||||||
$this->tabR[6][9]=array('0:1.8','1.8:2.2','2.2:2.5','2.5:2.9','2.9:3.4','3.4:4','4:4.5','4.5:5','5:5.6','5.6:');
|
|
||||||
$this->tabR[6][10]=array('0:1.3','1.3:1.7','1.7:2','2:2.4','2.4:2.9','2.9:3.5','3.5:4','4:4.5','4.5:5.1','5.1:');
|
|
||||||
$this->tabR[6][11]=array('0:8.3','8.3:9.3','9.3:10','10:11','11:12.3','12.3:13.7','13.7:15','15:16.3','16.3:17.7','17.7:');
|
|
||||||
$this->tabR[6][12]=array('0:4.7','4.7:5.5','5.5:6','6:6.8','6.8:7.9','7.9:8.9','8.9:10','10:11.1','11.1:12.1','12.1:');
|
|
||||||
$this->tabR[6][13]=array('0:3','3:4.8','4.8:6','6:7.8','7.8:10.2','10.2:12.6','12.6:15','15:17.4','17.4:19.8','19.8:');
|
|
||||||
$this->tabR[6][14]=array('0:3','3:4.8','4.8:6','6:7.8','7.8:10.2','10.2:12.6','12.6:15','15:17.4','17.4:19.8','19.8:');
|
|
||||||
$this->tabR[6][15]=array('0:2','2:2.3','2.3:2.5','2.5:2.8','2.8:3.2','3.2:3.6','3.6:4.0','4.0:4.4','4.4:4.8','4.8:');
|
|
||||||
$this->tabR[6][16]=array('0:1.7','1.7:1.9','1.9:2','2:2.2','2.2:2.5','2.5:2.7','2.7:3','3:3.3','3.3:3.5','3.5:');
|
|
||||||
$this->tabR[6][17]=array('0:4.7','4.7:5.5','5.5:6','6:6.8','6.8:7.9','7.9:8.9','8.9:10','10:11.1','11.1:12.1','12.1:');
|
|
||||||
|
|
||||||
?>
|
|
@ -1,9 +0,0 @@
|
|||||||
<?
|
|
||||||
class Rncs {
|
|
||||||
|
|
||||||
function Rncs () {}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
|
@ -1,404 +0,0 @@
|
|||||||
<?
|
|
||||||
define('HOST_INSEE', 'avis-situation-sirene.insee.fr');
|
|
||||||
define('SITE_INSEE', 'http://'. HOST_INSEE .'/');
|
|
||||||
define('HOST_PJ', 'www.pagesjaunes.fr');
|
|
||||||
define('SITE_PJ', 'http://'. HOST_PJ .'/');
|
|
||||||
define('SITE_SOCIETE', 'http://www.societe.com/');
|
|
||||||
|
|
||||||
include('/var/www/_includes/includes/insee.class.php');
|
|
||||||
//include('includes/normad.class.php');
|
|
||||||
include('/var/www/_includes/includes/fonctions.php');
|
|
||||||
|
|
||||||
/* v0.1 Extraction d'informations INSEE en ligne de commande.
|
|
||||||
|
|
||||||
Usage: <?=$argv[0]?> <extract type> <fileIn> <fileInFmt> <fileOut> <fileOutFmt>
|
|
||||||
|
|
||||||
Where <extract type> is :
|
|
||||||
id siren.tm.fr : Fiche d'identite INSEE (établissement+entreprise)
|
|
||||||
lst siren.tm.fr : Liste des etablissements du SIREN (+infos entreprise)
|
|
||||||
rncs societe.com : Informations du RNCS
|
|
||||||
pj pagesjaunes.fr : Données des pages jaunes
|
|
||||||
coface cofacerating.fr : Coface
|
|
||||||
|
|
||||||
Where <fileInFmt> is :
|
|
||||||
csv Fichier IN au format CSV (; ou ,) SIREN;NIC;REF
|
|
||||||
plat Fichier IN au format plat (blancs significatifs) SIREN_____NIC__REF______________
|
|
||||||
|
|
||||||
Where <fileOutFmt> is : csv / todo
|
|
||||||
|
|
||||||
Le fichier en entrée doit être au format <fileInFmt> et contenir le SIREN en première colonne.
|
|
||||||
*/
|
|
||||||
|
|
||||||
$insee=&new Insee();
|
|
||||||
function getInfosSirene($sirenLu, $nicLu='') {
|
|
||||||
$tabRet=array();
|
|
||||||
|
|
||||||
$invalide=false;
|
|
||||||
if (valideSiren($sirenLu)==false) {
|
|
||||||
$libelleErreur='SIREN invalide';
|
|
||||||
$invalide=true;
|
|
||||||
}
|
|
||||||
if ( $nicLu<>'' && valideSiren($sirenLu, $nicLu)==false) {
|
|
||||||
$libelleErreur='SIRET invalide';
|
|
||||||
$invalide=true;
|
|
||||||
}
|
|
||||||
if ($invalide==true)
|
|
||||||
{
|
|
||||||
$siret=$sirenLu.$nicLu;
|
|
||||||
$str=date('d/m/Y à H:i:s') .';'. $libelleErreur .';'. $siret .';;;;;;;;;;;;;;;;;;;;;;;';
|
|
||||||
$fp=fopen('/var/www/_includes/partenaires/insee/debug.csv', 'a');
|
|
||||||
fwrite($fp, $str."\r\n");
|
|
||||||
fclose($fp);
|
|
||||||
$num=$key+1;
|
|
||||||
flush();
|
|
||||||
} else { // La demande est valide on va à l'INSEE
|
|
||||||
/** Paramètre de requête "option" à l'insee :
|
|
||||||
** 1: Fiche du siège + Données entreprises
|
|
||||||
** 2: Tous les établissements de l'entreprise
|
|
||||||
** 3: Un établissement particulier
|
|
||||||
** 4: Département
|
|
||||||
**/
|
|
||||||
if ($nicLu<>'') $option=3;
|
|
||||||
else $option=1;
|
|
||||||
|
|
||||||
$libelleErreur='Erreur SCRIPT Inconnue';
|
|
||||||
$tabInfoEtab=array();
|
|
||||||
$tabInfoEntrep=array();
|
|
||||||
|
|
||||||
/** Etape de connexion au site de l'INSEE pour simuler correctement un utilisateur WEB
|
|
||||||
**/
|
|
||||||
$response1=getUrl(SITE_INSEE);
|
|
||||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'SIRENET_Script/Accueil/script_page_accueil.asp');
|
|
||||||
|
|
||||||
$response=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
|
|
||||||
$response=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
|
|
||||||
|
|
||||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_haut.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
|
|
||||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
|
|
||||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_bas.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/frame_interrogation.asp?ACTION=nouvelle&Niveau=siren');
|
|
||||||
|
|
||||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_haut.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle');
|
|
||||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_bas.asp?grille=siren&action=nouvelle', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle');
|
|
||||||
|
|
||||||
if ($nicLu=='') //Faire une boucle de recherche de tous les établissement et y inclure le reste du traitement
|
|
||||||
{
|
|
||||||
// Requête d'interrogation
|
|
||||||
$postData=array(
|
|
||||||
'siren'=>$sirenLu,
|
|
||||||
'option'=>2,
|
|
||||||
'nic'=>'',
|
|
||||||
'dep'=>'',
|
|
||||||
'listeDep'=>'');
|
|
||||||
|
|
||||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', $response1["header"]["Set-Cookie"], $postData, SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle');
|
|
||||||
$action='nouveau';
|
|
||||||
$referer=SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false';
|
|
||||||
$nbRepTot=$pageCour=$nbTotPage=$nbRepParPage=$numEtab=0;
|
|
||||||
$tabInfoEtab=array();
|
|
||||||
|
|
||||||
while(true)
|
|
||||||
{
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action='.$action, $response1["header"]["Set-Cookie"], '', $referer);
|
|
||||||
if ($responseQ['code']==302)
|
|
||||||
{
|
|
||||||
//$libelleErreur='Erreur INSEE inconnue 1';
|
|
||||||
|
|
||||||
// Siren Invalide ou autre erreur non répertoriée !
|
|
||||||
$header=$responseQ['header'];
|
|
||||||
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur')
|
|
||||||
{
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
|
||||||
$responseErreur=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Erreur_principal.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur',true);
|
|
||||||
$pos=strpos($responseErreur['body'], '<td valign=top bgcolor="#FFCC33"><font face=Arial size=2><b>');
|
|
||||||
if ($pos>0){
|
|
||||||
$posFin=strpos($responseErreur['body'], '</b></font></td>', $pos+60);
|
|
||||||
$libelleErreur=trim(substr($responseErreur['body'], $pos+60, $posFin-($pos+60)));
|
|
||||||
} else
|
|
||||||
$libelleErreur='Erreur INSEE inconnue';
|
|
||||||
}
|
|
||||||
|
|
||||||
// On déroule les URLs d'appels liste des établissements
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
|
||||||
//sleep(1);
|
|
||||||
// Frames réponse niveau Etab
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste');
|
|
||||||
$responseListe=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste', true);
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Liste_bas.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=liste');
|
|
||||||
$responseListe=$responseListe['body'];
|
|
||||||
|
|
||||||
$pos=strpos($responseListe, 'Nombre total de réponses : '."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
|
|
||||||
if ($pos>0) {
|
|
||||||
$posFin=strpos($responseListe, '</b></font>', $pos+73);
|
|
||||||
$nbRepTot=trim(substr($responseListe, $pos+73, $posFin-($pos+73)));
|
|
||||||
}
|
|
||||||
$pos=strpos($responseListe, ' - Affichage de la page '."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
|
|
||||||
if ($pos>0) {
|
|
||||||
$posFin=strpos($responseListe, ' - </b></font>', $pos+75);
|
|
||||||
$strPages=trim(substr($responseListe, $pos+75, $posFin-($pos+75)));
|
|
||||||
$tabPages=explode(' / ', $strPages);
|
|
||||||
$pageCour=$tabPages[0];
|
|
||||||
$nbTotPage=$tabPages[1];
|
|
||||||
}
|
|
||||||
$pos=strpos($responseListe, ' - </b></font>'."\r\n\t\t\t".'<font face="Arial" size="2"><b>');
|
|
||||||
if ($pos>0) {
|
|
||||||
$posFin=strpos($responseListe, '</b></font>', $pos+60);
|
|
||||||
$nbRepParPage=trim(substr($responseListe, $pos+60, $posFin-($pos+60)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO = Récupérer les infos étab + entrep pour chaque ligne du tableau !!!*
|
|
||||||
*/
|
|
||||||
if ($libelleErreur=='Erreur SCRIPT Inconnue')
|
|
||||||
$libelleErreur='';
|
|
||||||
for ($i=1;$i<11; $i++)
|
|
||||||
{
|
|
||||||
if ($numEtab==$nbRepTot)
|
|
||||||
break; // Il n'y a pas plus d'établissement à récupérer ! On sort...
|
|
||||||
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action=detail&numtableau='.$i, $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp');
|
|
||||||
if ($responseQ['code']==302)
|
|
||||||
{
|
|
||||||
// Siren Invalide ou autre erreur non répertoriée !
|
|
||||||
$header=$responseQ['header'];
|
|
||||||
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i)
|
|
||||||
{
|
|
||||||
// On déroule les URLs d'appels fiche siège
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege&numtableau='.$i, $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
|
||||||
//sleep(1);
|
|
||||||
// Frames réponse niveau Etab
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
|
||||||
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i, true);
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=siege&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=siege&numtableau='.$i);
|
|
||||||
$responseEtab=$responseEtab['body'];
|
|
||||||
|
|
||||||
// Récupération de la fiche entreprise INSEE
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege&numtableau='.$i.'&origine=liste');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i);
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i);
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i);
|
|
||||||
$responseEntreprise=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=entreprise&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i, true);
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=entreprise&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/Frame_Reponse.asp?niveau=entreprise&dest=detail&origine=liste&numtableau='.$i);
|
|
||||||
$responseEntreprise=$responseEntreprise['body'];
|
|
||||||
$tabInfoEntrep=getDataEntreprise($responseEntreprise);
|
|
||||||
}
|
|
||||||
elseif (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i)
|
|
||||||
{
|
|
||||||
// On déroule les URLs d'appels établissement
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement&numtableau='.$i, $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
|
||||||
//sleep(1);
|
|
||||||
// Frames réponse niveau Etab
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
|
||||||
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=etablissement&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i, true);
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=etablissement&numtableau='.$i.'&origine=liste', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?origine=liste&dest=detail&niveau=etablissement&numtableau='.$i);
|
|
||||||
$responseEtab=$responseEtab['body'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$tabInfoEtab=getDataEtablissement($responseEtab);
|
|
||||||
$tabRet[]=array_merge($tabInfoEtab, $tabInfoEntrep);
|
|
||||||
|
|
||||||
if ($libelleErreur<>'' && $tabInfoEtab['siret'] =='') $siret=$sirenLu . $nicLu;
|
|
||||||
else $siret=$tabInfoEtab['siret'];
|
|
||||||
|
|
||||||
$str= date('d/m/Y à H:i:s') .';'.
|
|
||||||
$libelleErreur .';'.
|
|
||||||
// Siège
|
|
||||||
$siret .';'.
|
|
||||||
$tabInfoEtab['active'] .';'.
|
|
||||||
$tabInfoEtab['dateAbsActivite'] .';'.
|
|
||||||
$tabInfoEtab['typeEtablissement'] .';'.
|
|
||||||
$tabInfoEtab['dateMAJ'] .';'.
|
|
||||||
$tabInfoEtab['dateCreation'] .';'.
|
|
||||||
$tabInfoEtab['raisonSociale'] .';'.
|
|
||||||
$tabInfoEtab['Enseigne'] .';'.
|
|
||||||
$tabInfoEtab['NafCode'] .';'.
|
|
||||||
$tabInfoEtab['NafLib'] .';'.
|
|
||||||
$tabInfoEtab['AdresseLigne1'] .';'.
|
|
||||||
$tabInfoEtab['AdresseLigne2'] .';'.
|
|
||||||
$tabInfoEtab['AdresseLigne3'] .';'.
|
|
||||||
$tabInfoEtab['etatJuridique'] .';'.
|
|
||||||
$tabInfoEtab['dateEtatJuridique'] .';'.
|
|
||||||
// Entreprise
|
|
||||||
$tabInfoEntrep['dateCreationEntrep'] .';'.
|
|
||||||
$tabInfoEntrep['raisonSocialeEntrep'] .';'.
|
|
||||||
$tabInfoEntrep['sigle'] .';'.
|
|
||||||
$tabInfoEntrep['NafCodeEntrep'] .';'.
|
|
||||||
$tabInfoEntrep['NafLibEntrep'] .';'.
|
|
||||||
$tabInfoEntrep['FJCodeEntrep'] .';'.
|
|
||||||
$tabInfoEntrep['FJLibEntrep'] .';'.
|
|
||||||
$tabInfoEntrep['nbEtabActifs'] .';';
|
|
||||||
|
|
||||||
$fp=fopen('/var/www/_includes/partenaires/insee/debug.csv', 'a');
|
|
||||||
fwrite($fp, $str."\r\n");
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
$numEtab++;
|
|
||||||
$num=$key+1;
|
|
||||||
$typeEtablissement=$tabInfoEtab['typeEtablissement'];
|
|
||||||
// echo "Question $num/$nbLignes : Demande=$sirenLu$nicLu Etablissement $numEtab/$nbRepTot $typeEtablissement=$siret $libelleErreur\r\n";
|
|
||||||
flush();
|
|
||||||
sleep(1);
|
|
||||||
|
|
||||||
}//end for
|
|
||||||
}//end if
|
|
||||||
if ($pageCour==$nbTotPage) {
|
|
||||||
// On sort de la boucle de passage à la page de liste suivante car il n'y a plus d'autres pages
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
$action='listeplus';
|
|
||||||
$referer=SITE_INSEE .'REPERTOIRE/Reponse/Liste_principal.asp';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} //Fin While
|
|
||||||
// die('Boucle');
|
|
||||||
} /* Fin de la boucle option 'lst' */ else
|
|
||||||
{
|
|
||||||
// Requête d'interrogation
|
|
||||||
$postData=array('siren'=>$sirenLu,
|
|
||||||
'option'=>$option,
|
|
||||||
'nic'=>$nicLu,
|
|
||||||
'dep'=>'',
|
|
||||||
'listeDep'=>'');
|
|
||||||
|
|
||||||
$response=getUrl(SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false', $response1["header"]["Set-Cookie"], $postData, SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?grille=siren&action=nouvelle');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/question.asp?action=nouveau', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
|
||||||
if ($responseQ['code']==302)
|
|
||||||
{
|
|
||||||
//$libelleErreur='Erreur INSEE inconnue 1';
|
|
||||||
|
|
||||||
// Siren Invalide ou autre erreur non répertoriée !
|
|
||||||
$header=$responseQ['header'];
|
|
||||||
if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur')
|
|
||||||
{
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
|
||||||
$responseErreur=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Erreur_principal.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=erreur',true);
|
|
||||||
$pos=strpos($responseErreur['body'], '<td valign=top bgcolor="#FFCC33"><font face=Arial size=2><b>');
|
|
||||||
if ($pos>0){
|
|
||||||
$posFin=strpos($responseErreur['body'], '</b></font></td>', $pos+60);
|
|
||||||
$libelleErreur=trim(substr($responseErreur['body'], $pos+60, $posFin-($pos+60)));
|
|
||||||
} else
|
|
||||||
$libelleErreur='Erreur INSEE inconnue';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ if (trim($header['Location'])=='/REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege')
|
|
||||||
// L'établissement demandé est un siège !
|
|
||||||
$option=1;
|
|
||||||
|
|
||||||
if ($option==3)
|
|
||||||
{
|
|
||||||
// On déroule les URLs d'appels établissement
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
|
||||||
//sleep(1);
|
|
||||||
// Frames réponse niveau Etab
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
|
||||||
$responseEtab=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=etablissement', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement', true);
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=etablissement', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=etablissement');
|
|
||||||
$responseEtab=$responseEtab['body'];
|
|
||||||
// On recherche si on est bien sur un fiche établissement
|
|
||||||
$pos=strpos($responseEtab, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Etablissement</B>');
|
|
||||||
if ($pos<1)
|
|
||||||
$libelleErreur='Erreur SCRIPT Fiche Etablissement non trouvée';
|
|
||||||
else
|
|
||||||
$libelleErreur='';
|
|
||||||
$responseSiege=$responseEtab;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// On déroule les URLs d'appels Sièges
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Interrogation/Interrogation_principal.asp?action=valider&grille=siren&waitframe=false');
|
|
||||||
//sleep(1);
|
|
||||||
// Frames réponse niveau sièges
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
|
||||||
$responseSiege=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege', true);
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=siege', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=siege');
|
|
||||||
$responseSiege=$responseSiege['body'];//strip_tags(html_entity_decode(), '<td>');
|
|
||||||
// On recherche si on est bien sur un fiche siège
|
|
||||||
$pos=strpos($responseSiege, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche siège</B>');
|
|
||||||
if ($pos<1)
|
|
||||||
$libelleErreur='Erreur SCRIPT Fiche Siège non trouvée';
|
|
||||||
else
|
|
||||||
$libelleErreur='';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Niveau entreprise
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=siege');
|
|
||||||
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_menu.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'SIRENET_Script/Interrogation/script_recherche_barre_haut.asp?niveau=siren', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/Reponse/Frame_Reponse.asp?dest=detail&niveau=entreprise');
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Reponse_haut.asp', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail');
|
|
||||||
$responseEntreprise=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_principal.asp?niveau=entreprise', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail', true);
|
|
||||||
$responseQ=getUrl(SITE_INSEE .'REPERTOIRE/Reponse/Detail_bas.asp?niveau=entreprise', $response1["header"]["Set-Cookie"], '', SITE_INSEE .'REPERTOIRE/reponse/frame_reponse.asp?niveau=entreprise&dest=detail');
|
|
||||||
$responseEntreprise=$responseEntreprise['body'];
|
|
||||||
$pos=strpos($responseEntreprise, '<table cols="2" width="100%"><tr><td bgcolor="#FFCC33" align="left"><font face="Arial" size="2"><B>Fiche Entreprise</B>');
|
|
||||||
if ($pos<1) {
|
|
||||||
$libelleErreur='Erreur SCRIPT Fiche Entreprise non trouvée';
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Recherche des données établissement
|
|
||||||
**/
|
|
||||||
$tabInfoEtab=getDataEtablissement($responseSiege);
|
|
||||||
|
|
||||||
/** Recherche des données entreprise
|
|
||||||
**/
|
|
||||||
$tabInfoEntrep=getDataEntreprise($responseEntreprise);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($libelleErreur<>'' && $tabInfoEtab['siret'] =='') $siret=$sirenLu . $nicLu;
|
|
||||||
else $siret=$tabInfoEtab['siret'];
|
|
||||||
|
|
||||||
$str= date('d/m/Y à H:i:s') .';'.
|
|
||||||
$libelleErreur .';'.
|
|
||||||
// Siège
|
|
||||||
$siret .';'.
|
|
||||||
$tabInfoEtab['active'] .';'.
|
|
||||||
$tabInfoEtab['dateAbsActivite'] .';'.
|
|
||||||
$tabInfoEtab['typeEtablissement'] .';'.
|
|
||||||
$tabInfoEtab['dateMAJ'] .';'.
|
|
||||||
$tabInfoEtab['dateCreation'] .';'.
|
|
||||||
$tabInfoEtab['raisonSociale'] .';'.
|
|
||||||
$tabInfoEtab['Enseigne'] .';'.
|
|
||||||
$tabInfoEtab['NafCode'] .';'.
|
|
||||||
$tabInfoEtab['NafLib'] .';'.
|
|
||||||
$tabInfoEtab['AdresseLigne1'] .';'.
|
|
||||||
$tabInfoEtab['AdresseLigne2'] .';'.
|
|
||||||
$tabInfoEtab['AdresseLigne3'] .';'.
|
|
||||||
$tabInfoEtab['etatJuridique'] .';'.
|
|
||||||
$tabInfoEtab['dateEtatJuridique'] .';'.
|
|
||||||
// Entreprise
|
|
||||||
$tabInfoEntrep['dateCreationEntrep'] .';'.
|
|
||||||
$tabInfoEntrep['raisonSocialeEntrep'] .';'.
|
|
||||||
$tabInfoEntrep['sigle'] .';'.
|
|
||||||
$tabInfoEntrep['NafCodeEntrep'] .';'.
|
|
||||||
$tabInfoEntrep['NafLibEntrep'] .';'.
|
|
||||||
$tabInfoEntrep['FJCodeEntrep'] .';'.
|
|
||||||
$tabInfoEntrep['FJLibEntrep'] .';'.
|
|
||||||
$tabInfoEntrep['nbEtabActifs'] .';'.
|
|
||||||
//echo $str.'<br/>';
|
|
||||||
|
|
||||||
$fp=fopen('/var/www/_includes/partenaires/insee/debug.csv', 'a');
|
|
||||||
fwrite($fp, $str."\r\n");
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
$num=$key+1;
|
|
||||||
$typeEtablissement=$tabInfoEtab['typeEtablissement'];
|
|
||||||
// echo "Ligne $num/$nbLignes : Question=$sirenLu$nicLu Retour $typeEtablissement=$siret $libelleErreur (PJ=$nbPJ)\r\n";
|
|
||||||
//echo $str."<br/>";
|
|
||||||
|
|
||||||
flush();
|
|
||||||
$tabRet=array(0=>array_merge($tabInfoEntrep, $tabInfoEtab));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $tabRet;
|
|
||||||
}
|
|
||||||
?>
|
|
Loading…
x
Reference in New Issue
Block a user