0); // Ferme tous les gestionnaires curl_multi_remove_handle($ch1); curl_multi_remove_handle($ch2); curl_multi_close($mh); // $iDb=new WDB(); $referer=''; $url='http://www.cofacerating.fr/portail/entreprise_identite/identite.asp?ip=pagespro&lg=fr&nsiren='.$siren; $page=getUrl($url, '', '', $referer, false, 'www.cofacerating.fr', '', 10); $this->body=$page['body']; $this->codeRetour=$page['code']; $this->header=$page['header']; $this->nscrl=@getTextInHtml($this->body, '&nscrl=', '=','&'); $this->rSocAdrCPVille=trim(str_replace(chr(160), ' ', html_entity_decode(utf8_encode(@getTextInHtml($this->body, ' Raison sociale
', '',''))))); $tmp=explode('
', $this->rSocAdrCPVille); $this->raisonSociale=trim($tmp[0]); unset($tmp[0]); $this->adresse=trim(strip_tags(implode(',', $tmp))); $this->tel=trim(@getTextInHtml($this->body, 'Téléphone
', '', '
')); $this->fax=trim(@getTextInHtml($this->body, 'Télécopie
', '
', '')); $this->web=trim(@getTextInHtml($this->body, 'Adresse internet
', ' class="tabval">')); $this->mail=trim(@getTextInHtml($this->body, '')); $bourse=trim(@getTextInHtml($this->body, 'Ville Bourse
', 'class="tabval">', '')); $tmp=explode('
', $bourse); $this->bourseIsin=trim($tmp[0]); $this->bourseMarche=trim($tmp[1]); $this->bourseVille=trim($tmp[2]); $infosDispo=trim(@getTextInHtml($this->body, 'Liste Produits
', '

', 'Un secteur ou une région en France

')); $tabTmp=explode('(.*)<\/a>/i', $lien, $matches); if ($matches[2]<>'') $this->tabInfos[$matches[2]]=$matches[1]; if (substr($matches[2], 0, 12)=='rapport éco.') $this->infoEco='http://www.cofacerating.fr/portail/entreprise_identite/'.$matches[1];//ip=pagespro& elseif (substr($matches[2], 0, 6)=='bilan ') $this->tabBilans[]=substr($matches[2], 6,strlen($matches[2])-6); } $this->activite=trim(str_replace(chr(160), ' ', html_entity_decode(utf8_encode(@getTextInHtml($this->body, 'Libellé code activité ', '', ''))))); $this->naf=trim(@getTextInHtml($this->body, '', $siren, '')); $strTmp=trim(@getTextInHtml($ste, 'RCS', 'RCS ', ' '.substr($siren,0,3))); $tabTmp=explode(' ', $strTmp); $this->rcsVille=$tabTmp[0];//RCS Paris B 552 144 503
$this->rcsType=$tabTmp[1]; $strTmp=trim(@getTextInHtml($ste, '
Code activité
', '
', '
')); $tabTmp=explode(' - ', $strTmp); $this->naf=$tabTmp[0]; $this->nafLib=$tabTmp[1]; //
Siège social
75 Avenue la Grande Armee - 75116 PARIS 16
$strTmp=trim(@getTextInHtml($ste, '
Capital social', '
', '
')); $this->capitalType='social'; $tabTmp=explode(' ', $strTmp); $this->capitalMontant=str_replace(',', '.', str_replace('.', '', $tabTmp[0])); $this->capitalDevise =$tabTmp[1]; $this->fj=trim(@getTextInHtml($ste, '
Forme juridique', '
', '
')); $this->nationalite=trim(@getTextInHtml($ste, '
Nationalité
', '
', '
')); $strTmp=trim(@getTextInHtml($ste, ' DIRIGEANT(S) 
', '
', '
')); $tabTmp=explode('
', $strTmp); foreach ($tabTmp as $k=>$dir) { if (trim($dir)=='') break; $tabTmp1=explode('
', $dir); $tabTmp2=explode('représenté par', $tabTmp1[1]); if (isset($tabTmp2[1]) && $tabTmp2[1]<>'') { $soc=trim($tabTmp2[0]); $diri=trim($tabTmp2[1]); } else { $soc=''; $diri=trim($tabTmp1[1]); } preg_match("/^(Mme|M\.|Mlle|Mle|M) ([A-Z\s]*) ([A-Z][a-z\s]*)/", $diri, $matches); //print_r($matches); $this->tabDirigeants[]=array('FONCTION'=>trim(strip_tags($tabTmp1[0])), 'SOCIETE'=>$soc, 'GENRE'=>$matches[1], 'PRENOM'=>trim($matches[3]), 'NOM'=>trim($matches[2])); } $this->dateImmatriculation=trim(@getTextInHtml($ste, '
Immatriculation', '
', '
')); //06-03-2007
/* Date Creation = "" En bourse = "" Effectif societe = "" Dirigeants : **/ $urlRacine='http://infobilan.decideur.com/'; $tabPost=array( 'choix'=>'1', 'pagePrecedente'=>'recherche_entreprise.html', 'nomsocRech'=>'', 'cpRech'=>'', 'villeRech'=>'', 'nomdirRech'=>'', 'predirRech'=>'', 'sirenRech'=>$siren, 'telRech'=>'', 'Rechercher.x'=>round(79), 'Rechercher.y'=>round(19),); $url=$urlRacine.'liste_result.html'; $referer=$urlRacine.'recherche_entreprise.html'; $page=getUrl($url,'', $tabPost, $referer, false, 'infobilan.decideur.com'); $this->body=$page['body']; $strCookie=$page['header']['Set-Cookie']; $refererInfoD=$url; if(preg_match_all('/
(.*)<\/a><\/span>
/i', $page['body'], $matches)) $urlInfoD=$urlRacine.'choix_pdt.html?'.$matches[1][0]; else $urlInfoD=''; $page=getUrl($this->infoEco, '', '', $url, false, 'www.cofacerating.fr'); if (strpos($page['body'], 'Choix du mode de paiement')===false) { // Le rapport éco. est cadeau !!! $this->infoEco=true; $eco=$page['body']; //die ($eco); $strTmp=strip_tags(@getTextInHtml($eco, ' class="tabligne" > Capital   (', '(', '')); $tabTmp=explode(')', $strTmp); $this->capitalType=$tabTmp[0]; $tabTmp=explode(' ', $tabTmp[1]); $this->capitalMontant=trim(str_replace(chr(160), '', $tabTmp[0])); $this->capitalDevise =trim(str_replace(chr(160), '', $tabTmp[1])); $this->steInactive=trim(@getTextInHtml($eco, ' class="tabligne" > Société inactive', 'class="tabval" >', '')); $this->dateCreation=trim(@getTextInHtml($eco, ' class="tabligne" > Date de création', 'class="tabval" >', '')); $this->fj=trim(@getTextInHtml($eco, ' class="tabligne" > Forme juridique', 'class="tabval" >', '')); $this->effectif=trim(@getTextInHtml($eco, ' class="tabligne" > Effectif', 'class="tabval" >', '')); if (count($this->tabDirigeants)==0) { // Si il y a déjà des dirigeants on garde ceux de Société.com !!! $strTmp=trim(@getTextInHtml($eco, ' class="tabligne" > Cotation en bourse', '', ' Effectif')); $tabTmp=explode('', $strTmp); foreach ($tabTmp as $k=>$dir) { $tabTmp1=explode('', $dir); $tabTmp2=explode(' ', trim(strip_tags($tabTmp1[1]))); $this->tabDirigeants[]=array('FONCTION'=>trim(strip_tags($tabTmp1[0])), 'GENRE'=>trim($tabTmp2[0]), 'PRENOM'=>trim($tabTmp2[1]), 'NOM'=>trim($tabTmp2[2])); } } $this->strLiensFi=trim(strip_tags(@getTextInHtml($eco, 'LIENS FINANCIERS', '', ''))); $this->strElemsFi=trim(strip_tags(@getTextInHtml($eco, 'ELEMENTS FINANCIERS', '', ''))); } $refererP='http://www.score3.fr/'; $urlP='http://www.score3.fr/entreprise.shtml?siren='.$siren; $page=getUrl($urlP, '', '', $refererP, false, 'www.score3.fr'); $pou=$page['body']; $fp=fopen('./pouet.html', 'w'); fwrite($fp, $pou); fclose($fp); if ($urlInfoD<>'') { $page=getUrl($urlInfoD,$strCookie,'', $refererInfoD, false, 'infobilan.decideur.com'); $referer=$urlInfoD; if ($this->nscrl==0) $this->nscrl=@getTextInHtml($url, 'nscrlP=', '=','&'); $url=$urlRacine.'fiche_ident.html'; $page=getUrl($url,$strCookie,'', $referer, false, 'infobilan.decideur.com'); $this->body=$page['body']; if ($this->raisonSociale=='') $this->raisonSociale=trim(@getTextInHtml($this->body, 'Société', ' :', '')); if ($this->adresse=='') $this->adresse=trim(@getTextInHtml($this->body, 'Adresse :', '', '')); if ($this->tel=='') $this->tel=trim(@getTextInHtml($this->body, 'Tél', '', '
')); if ($this->fax=='') $this->fax=trim(@getTextInHtml($this->body, 'Fax', ' :', '
')); if ($this->web=='') $this->web=trim(@getTextInHtml($this->body, 'Site Web', '
')); if ($this->mail=='') $this->mail=trim(@getTextInHtml($this->body, 'E-mail', '')); if ($this->naf=='') $this->naf=trim(@getTextInHtml($this->body, 'Code NAF', ' :', '')); if(preg_match('/Capital social<\/span> : (\d*)(.*)
/isU', $this->body, $matches) && ($this->capitalMontant=='' || $this->capitalDevise=='')) { $this->capitalMontant=trim($matches[1]); $this->capitalDevise=trim($matches[2]); } if ($this->fj=='') $this->fj=trim(@getTextInHtml($this->body, 'Forme juridique', ' :', '
')); if ($this->nationalite=='') $this->nationalite=trim(@getTextInHtml($this->body, 'Nationalité', ' :', '')); if ($this->effectif=='') $this->effectif=trim(@getTextInHtml($this->body, 'Effectif', ' :', '
')); if ($this->activite=='') $this->activite=trim(@getTextInHtml($this->body, 'Activité', ' :', '
')); /** Actionnaires **/ $strTmp=trim(@getTextInHtml($this->body, 'ACTIONNAIRES
', '
', '

')); if(preg_match_all('/

(.*)<\/span> - Participation<\/span> : (.*) %
(.*)<\/p>/isU', $strTmp, $matches)) { foreach ($matches[1] as $i=>$nom) { $this->tabAct[$i]['nom']=trim($nom); $this->tabAct[$i]['pct']=trim($matches[2][$i]); $this->tabAct[$i]['rcs']=trim(str_replace('RCS : ','',strip_tags($matches[3][$i]))); } } /** Filiales **/ $strTmp=trim(@getTextInHtml($this->body, 'FILIALES
', '

', '

')); if(preg_match_all('/

(.*)<\/span> - Participation<\/span> :(.*)%
(.*)<\/p>/isU', $strTmp, $matches)) { foreach ($matches[1] as $i=>$nom) { $this->tabFil[$i]['nom']=trim($nom); $this->tabFil[$i]['pct']=trim($matches[2][$i]); $this->tabFil[$i]['rcs']=trim(str_replace('RCS :','',strip_tags($matches[3][$i]))); } } /** CA et Résultat **/ $strTmp=trim(@getTextInHtml($this->body, '

PRINCIPAUX ELEMENTS FINANCIERS
', '

', '

')); if(preg_match('/

CA (.*)<\/span>(.*)
/isU', $strTmp, $matches)) { $this->derExerciceAnnee=trim($matches[1]); $this->derExerciceCA=trim(str_replace(':',' ', $matches[2])); } if(preg_match('/Résultat(.*)<\/span>(.*)$/isU', $strTmp, $matches)) { $this->derExerciceResultat=trim(str_replace(':',' ', $matches[2])); } $infoBilan=print_r($page, true); $fp=fopen('./infobilan.html', 'w'); fwrite($fp, $infoBilan); fclose($fp); } if ($this->nbEtab=='' || $this->nbEtab=='0') { $this->nbEtab=trim(strip_tags(str_replace('afficher la liste...', '', @getTextInHtml($pou, 'Etablissements ', '', '')))); $urlPEtab='http://www.score3.fr/etablissements.shtml?page=1&siren='.$siren; $refererPEtab=$urlP; $page=getUrl($urlPEtab, '', '', $refererPEtab, false, 'www.score3.fr'); $pou2=$page['body']; if(preg_match_all('/(\d*)<\/td>', '')); if ($this->dateImmatriculation=='' || $this->dateImmatriculation=='0') $this->dateImmatriculation=trim(@getTextInHtml($pou, '', '')); if ($this->dateFermeture=='' || $this->dateFermeture=='0') $this->dateFermeture=trim(@getTextInHtml($pou, '', '')); if ($this->tel=='' || $this->tel=='0') $this->tel=trim(@getTextInHtml($pou, '', '')); if ($this->fax=='' || $this->fax=='0') $this->fax=trim(@getTextInHtml($pou, '', '')); $strTmp=trim(@getTextInHtml($pou, 'Procédures collectives', '
(.*)<\/td><\/tr><\/table>/isU', $pou2, $matches)) { foreach ($matches[1] as $i=>$nic) { $strEtab=$matches[2][$i]; $this->tabEtab[$i]['siren']=$siren; $this->tabEtab[$i]['nic']=$nic; $this->tabEtab[$i]['siret']=$siren.$nic; $this->tabEtab[$i]['enseigne']=trim(str_replace(chr(160),' ',utf8_decode(strip_tags(@getTextInHtml($strEtab, '', '">', ''))))); $this->tabEtab[$i]['adresse']=trim(str_replace(chr(160),' ',utf8_decode(strip_tags(@getTextInHtml($strEtab, '', '">', '
'))))); $strTmp=trim(str_replace(chr(160),' ',utf8_decode(strip_tags(@getTextInHtml($strEtab, '', '
', '
'))))); $tabTmp=explode(' ', $strTmp); $this->tabEtab[$i]['cp']=$tabTmp[0]; unset($tabTmp[0]); $this->tabEtab[$i]['ville']=implode(' ',$tabTmp); $strTmp=trim(strip_tags(@getTextInHtml($strEtab, '
', '">', ')'))); $tabTmp=explode('(', $strTmp); $this->tabEtab[$i]['naf_code']=$tabTmp[1]; $this->tabEtab[$i]['naf_lib']=trim(str_replace(chr(160),' ',utf8_decode($tabTmp[0]))); if (preg_match('/
T.l\.(.*)$/i',$strEtab,$matches2)) $this->tabEtab[$i]['tel']=trim(str_replace(chr(160),' ',utf8_decode($matches2[1]))); else $this->tabEtab[$i]['tel']=''; } } $this->nbEtab=count($this->tabEtab); $fp=fopen('./pouet_etab.html', 'w'); fwrite($fp, $pou2); fclose($fp); } if ($this->effectif=='' || $this->effectif=='0' || $this->effectif=='NC') $this->effectif=trim(@getTextInHtml($pou, '
Effectifs', '
Date d\'immatriculation', '
Date de fin d\'exploitation', '
Téléphone', '
Fax', '
', '(.*)<\/td>(.*)<\/td><\/tr>/isU', $strTmp, $matches)) { foreach ($matches[1] as $i=>$jug) { $this->tabJug[$i]['date']=$matches[1][$i]; $this->tabJug[$i]['juge']=$matches[2][$i]; } } $this->score_pouey=trim(@getTextInHtml($pou, '')); $this->score_conan=trim(@getTextInHtml($pou, '')); $this->score_afdcc=trim(@getTextInHtml($pou, '')); $this->vigilance =trim(@getTextInHtml($pou, '')); if(preg_match('/Date de l\'exercice<\/td>(.*) sur (\d*) mois<\/td><\/tr>/isU', $pou, $matches)) { $this->derExerciceDClot=trim($matches[1]); $this->derExerciceDuree=trim($matches[2]); } /* Siret SIEGE 2 Fonction, Nom Prénoù ET Date NAissance du PP 5 Liste des actes */ if ($this->codeRetour==200) return true; return false; } } ?>