127 lines
2.9 KiB
PHP
127 lines
2.9 KiB
PHP
|
<?php
|
|||
|
if (!$_SESSION['connected']) die();
|
|||
|
|
|||
|
$identifier = $_REQUEST['identifier'];
|
|||
|
$CompanyProductIdentifier = $_REQUEST['pidentifier'];
|
|||
|
|
|||
|
function strip_selected_tags($str, $tags = "", $stripContent = false){
|
|||
|
preg_match_all("/<([^>]+)>/i",$tags,$allTags,PREG_PATTERN_ORDER);
|
|||
|
foreach ($allTags[1] as $tag){
|
|||
|
if ($stripContent) {
|
|||
|
$str = preg_replace("/<".$tag."[^>]*>.*<\/".$tag.">/iU","",$str);
|
|||
|
}
|
|||
|
$str = preg_replace("/<\/?".$tag."[^>]*>/iU","",$str);
|
|||
|
}
|
|||
|
return $str;
|
|||
|
}
|
|||
|
/*
|
|||
|
placeOrder
|
|||
|
CompanyProductIdentifier
|
|||
|
Language
|
|||
|
CreditOpinionCurrency
|
|||
|
Country
|
|||
|
|
|||
|
getCompanyReport
|
|||
|
OrderReference
|
|||
|
MimeType
|
|||
|
*/
|
|||
|
require_once 'graydon/graydonws.php';
|
|||
|
|
|||
|
//placeOrder
|
|||
|
$request = new StdClass();
|
|||
|
$request->Authentication_Parameters = $authentication;
|
|||
|
$request->OrderCreatorEmail = 'mricois@scores-decisions.com';
|
|||
|
$request->CompanyProductIdentifier = $CompanyProductIdentifier;
|
|||
|
$request->PartnerData = '';
|
|||
|
|
|||
|
$firephp->log($request,'requete');
|
|||
|
try
|
|||
|
{
|
|||
|
$placeOrderResult = $graydon->placeOrder($request);
|
|||
|
$firephp->log($placeOrderResult,'placeOrder');
|
|||
|
}catch( SoapFault $exception ){
|
|||
|
// Print the exception
|
|||
|
print "\n Exception ";
|
|||
|
var_dump($exception->detail);
|
|||
|
}
|
|||
|
?>
|
|||
|
<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
|
|||
|
//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 = 'html';
|
|||
|
|
|||
|
$firephp->log($request,'requete');
|
|||
|
try
|
|||
|
{
|
|||
|
$reportResult = $graydon->getCompanyReport($request);
|
|||
|
$firephp->log($reportResult,'reportResult');
|
|||
|
$html = $reportResult->ReportText;
|
|||
|
$html = str_replace('<h1 class="header">Graydon UK</h1>','',$html); //Suppression du titre
|
|||
|
$html = preg_replace('@<title[^>]*?>.*?</title>@si', '', $html); //Suppression du titre
|
|||
|
$html = preg_replace('@<title[^>]*?>.*?</title>@si', '', $html); //Suppression du titre
|
|||
|
|
|||
|
//$html = strip_selected_tags($html, 'head', true);
|
|||
|
|
|||
|
//Enregistrement du fichier xml
|
|||
|
/*
|
|||
|
$path = PATH_DATA.'/graydon';
|
|||
|
$fileName = str_replace(':', '-', $identifier).'.xml';
|
|||
|
$tabXML = (array)$reportResult->ReportXML;
|
|||
|
$xml = $tabXML['any'];
|
|||
|
file_put_contents($path.'/'.$fileName, $xml);
|
|||
|
*/
|
|||
|
|
|||
|
}catch( SoapFault $exception ){
|
|||
|
// Print the exception
|
|||
|
print "\n Exception ";
|
|||
|
var_dump($exception->detail);
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
$dom = new DomDocument();
|
|||
|
$dom->loadXML($xml);
|
|||
|
$companyReport = $dom->getElementsByTagName('CompanyReport');
|
|||
|
*/
|
|||
|
|
|||
|
?>
|
|||
|
<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>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|