2009-04-07 17:44:17 +00:00
|
|
|
|
<?php
|
|
|
|
|
if (!$_SESSION['connected']) die();
|
|
|
|
|
|
|
|
|
|
$identifier = $_REQUEST['identifier'];
|
|
|
|
|
$CompanyProductIdentifier = $_REQUEST['pidentifier'];
|
|
|
|
|
|
2009-04-09 17:10:02 +00:00
|
|
|
|
require_once 'graydon/functions.php';
|
2009-04-07 17:44:17 +00:00
|
|
|
|
require_once 'graydon/graydonws.php';
|
|
|
|
|
|
2009-04-09 17:10:02 +00:00
|
|
|
|
$path = PATH_DATA.'/graydon';
|
|
|
|
|
$fileName = str_replace(':', '-', $identifier).'.xml';
|
2009-04-07 17:44:17 +00:00
|
|
|
|
|
2009-04-09 17:10:02 +00:00
|
|
|
|
if(!file_exists($path.'/'.$fileName)){
|
|
|
|
|
/*
|
|
|
|
|
placeOrder
|
|
|
|
|
CompanyProductIdentifier
|
|
|
|
|
Language
|
|
|
|
|
CreditOpinionCurrency
|
|
|
|
|
Country
|
|
|
|
|
|
|
|
|
|
getCompanyReport
|
|
|
|
|
OrderReference
|
|
|
|
|
MimeType
|
|
|
|
|
*/
|
|
|
|
|
//placeOrder
|
2009-04-07 17:44:17 +00:00
|
|
|
|
$request = new StdClass();
|
|
|
|
|
$request->Authentication_Parameters = $authentication;
|
2009-04-09 17:10:02 +00:00
|
|
|
|
$request->OrderCreatorEmail = 'mricois@scores-decisions.com';
|
|
|
|
|
$request->CompanyProductIdentifier = $CompanyProductIdentifier;
|
|
|
|
|
$request->PartnerData = '';
|
2009-04-07 17:44:17 +00:00
|
|
|
|
|
|
|
|
|
$firephp->log($request,'requete');
|
|
|
|
|
try
|
|
|
|
|
{
|
2009-04-09 17:10:02 +00:00
|
|
|
|
$placeOrderResult = $graydon->placeOrder($request);
|
|
|
|
|
$firephp->log($placeOrderResult,'placeOrder');
|
2009-04-07 17:44:17 +00:00
|
|
|
|
}catch( SoapFault $exception ){
|
|
|
|
|
// Print the exception
|
|
|
|
|
print "\n Exception ";
|
|
|
|
|
var_dump($exception->detail);
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-09 17:10:02 +00:00
|
|
|
|
//On v<>rifie l'<27>tat de le demande
|
|
|
|
|
if (isset($placeOrderResult) && $placeOrderResult->OrderStatus->OrderState == 'Completed'){
|
|
|
|
|
|
|
|
|
|
//getCompanyReport
|
|
|
|
|
$request = new StdClass();
|
|
|
|
|
$request->Authentication_Parameters = $authentication;
|
|
|
|
|
$request->LanguageCode = 'E'; //Sp<53>cifier la langue du rapport
|
|
|
|
|
$request->OrderReference = $placeOrderResult->OrderStatus->OrderReference;
|
|
|
|
|
$request->MimeType = 'xml';
|
|
|
|
|
|
|
|
|
|
$firephp->log($request,'requete');
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
$reportResult = $graydon->getCompanyReport($request);
|
|
|
|
|
$firephp->log($reportResult,'reportResult');
|
|
|
|
|
$xml = $reportResult->ReportXML;
|
|
|
|
|
|
|
|
|
|
//Enregistrement du fichier xml
|
|
|
|
|
$xml = $reportResult->ReportXML->any;
|
|
|
|
|
file_put_contents($path.'/'.$fileName, $xml);
|
|
|
|
|
|
|
|
|
|
}catch( SoapFault $exception ){
|
|
|
|
|
// Print the exception
|
|
|
|
|
print "\n Exception ";
|
|
|
|
|
var_dump($exception->detail);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//On prend les donn<6E>es du fichier
|
|
|
|
|
}else{
|
|
|
|
|
$firephp->log('Data depuis fichier XML');
|
|
|
|
|
$xml = file_get_contents($path.'/'.$fileName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//========= Affichage des informations =========
|
|
|
|
|
if(isset($xml) && $xml!=''){
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<table width="580" border="0" align="left" bgcolor="#FFFFFF">
|
|
|
|
|
<tr>
|
|
|
|
|
<td colspan="3"><img src="./img/rub_identite.png" width="577" height="36"></td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
$tabCompany = array();
|
|
|
|
|
|
|
|
|
|
//Cr<43>ation du DOM
|
|
|
|
|
$doc = new DOMDocument;
|
|
|
|
|
$doc->preserveWhiteSpace = false;
|
|
|
|
|
$doc->loadxml($xml);
|
|
|
|
|
|
|
|
|
|
//XPATH Method
|
|
|
|
|
$xpath = new DOMXPath($doc);
|
2009-04-07 17:44:17 +00:00
|
|
|
|
|
2009-04-09 17:10:02 +00:00
|
|
|
|
//Raison sociale
|
|
|
|
|
$query = '//GraydonUKCompanySchema/CompanyReportPage/CompanyReport/Company[@Type="Subject"]/Name';
|
|
|
|
|
$items = $xpath->query($query);
|
|
|
|
|
$tabCompany['RaisonSociale'] = $items->item(0)->nodeValue;
|
|
|
|
|
|
|
|
|
|
//Date de cr<63>ation de l'entreprise
|
|
|
|
|
$query = '//GraydonUKCompanySchema/CompanyReportPage/CompanyReport/Company[@Type="Subject"]/Date[@Type="Age_of_Company"]';
|
|
|
|
|
$items = $xpath->query($query);
|
|
|
|
|
if ($items->length>0){
|
|
|
|
|
foreach ($items->item(0)->attributes as $attrName => $attrNode) {
|
|
|
|
|
if($attrName == 'Format'){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$tabCompany['DateCreation'] = $items->item(0)->nodeValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Forme l<>gale
|
|
|
|
|
$query = '//GraydonUKCompanySchema/CompanyReportPage/CompanyReport/Legal_Form';
|
|
|
|
|
$items = $xpath->query($query);
|
|
|
|
|
foreach ($items as $item) {
|
|
|
|
|
$tabCompany['FormeLegale'][] = $item->nodeValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Adresse
|
|
|
|
|
$query = '//GraydonUKCompanySchema/CompanyReportPage/CompanyReport/Address[@Type="Registered"]';
|
|
|
|
|
$items = $xpath->query($query);
|
|
|
|
|
foreach ($items as $item) {
|
|
|
|
|
$tabCompany['AddressRegistered']['EntireAddress'] = $item->getElementsByTagName('EntireAddress')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressRegistered']['Building'] = $item->getElementsByTagName('Building')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressRegistered']['Street'] = $item->getElementsByTagName('Street')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressRegistered']['Street'] = $item->getElementsByTagName('Town')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressRegistered']['City'] = $item->getElementsByTagName('City')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressRegistered']['County'] = $item->getElementsByTagName('County')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressRegistered']['PostCode'] = $item->getElementsByTagName('PostCode')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressRegistered']['Country'] = $item->getElementsByTagName('Country')->item(0)->nodeValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Adresse Commerciale
|
|
|
|
|
$query = '//GraydonUKCompanySchema/CompanyReportPage/CompanyReport/Address[@Type="Trading"]';
|
|
|
|
|
$items = $xpath->query($query);
|
|
|
|
|
foreach ($items as $item) {
|
|
|
|
|
$tabCompany['AddressTrading']['EntireAddress'] = $item->getElementsByTagName('EntireAddress')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressTrading']['Building'] = $item->getElementsByTagName('Building')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressTrading']['Street'] = $item->getElementsByTagName('Street')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressTrading']['Street'] = $item->getElementsByTagName('Town')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressTrading']['City'] = $item->getElementsByTagName('City')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressTrading']['County'] = $item->getElementsByTagName('County')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressTrading']['PostCode'] = $item->getElementsByTagName('PostCode')->item(0)->nodeValue;
|
|
|
|
|
$tabCompany['AddressTrading']['Country'] = $item->getElementsByTagName('Country')->item(0)->nodeValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Telephone
|
|
|
|
|
$query = '//GraydonUKCompanySchema/CompanyReportPage/CompanyReport/Communication[@Type="Telephone"]';
|
|
|
|
|
$items = $xpath->query($query);
|
|
|
|
|
foreach ($items as $item) {
|
|
|
|
|
$tabCompany['Telephone'][] = $item->nodeValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Fax
|
|
|
|
|
$query = '//GraydonUKCompanySchema/CompanyReportPage/CompanyReport/Communication[@Type="Fax"]';
|
|
|
|
|
$items = $xpath->query($query);
|
|
|
|
|
foreach ($items as $item) {
|
|
|
|
|
$tabCompany['Fax'][] = $item->nodeValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$firephp->log($tabCompany, 'tabCompany');
|
|
|
|
|
|
2009-04-07 17:44:17 +00:00
|
|
|
|
?>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colspan="3">
|
|
|
|
|
<?php print $html;?>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php
|
|
|
|
|
}else{
|
|
|
|
|
?>
|
|
|
|
|
<tr>
|
|
|
|
|
<td width="30"> </td>
|
|
|
|
|
<td width="500" class="StyleInfoLib">Aucune information disponible.</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|