Authentication_Parameters = $authentication; $request->Country = $pays; $path = PATH_DATA.'/graydon/method'; $fileName = strtolower('CompanyMatchMethods-'.$pays); if(!file_exists($path.'/'.$fileName)){ try { $result = $graydon->getCompanyMatchMethods($request); $count = count($result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod); if ($count>1){ $methods = $result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod; }elseif($count==1){ $methods[] = $result->CompanyMatchMethods->CompanyMatchMethod->MatchMethods->MatchMethod; } //Stockage du résultat de la méthode en cache file_put_contents($path.'/'.$fileName, serialize($methods)); }catch( SoapFault $fault ){ require_once 'soaperror.php'; processSoapFault($client,$fault,$tabInfo); } }else{ $methods = unserialize(file_get_contents($path.'/'.$fileName)); } if (isset($methods)){ $firephp->log($methods,'methods'); $firephp->log($method,'method'); //Affichage de la meilleur méthode de recherche OU la première $lien = 'Effectuer un recherche : '; $flagBestMethod = false; foreach($methods as $item){ $WithCity = $item->WithCity; $WithPostCode = $item->WithPostCode; if( ($item->BestMethod==TRUE && $item->MatchingMethod=='Keyword') && !isset($method) || $method=='keyword' ){ $flagBestMethod = TRUE; require_once realpath(dirname(__FILE__)).'/method_keyword.php'; }elseif( ($item->BestMethod==TRUE && $item->MatchingMethod=='Identifier') && !isset($method) || $method=='identifier' ){ $flagBestMethod = TRUE; require_once realpath(dirname(__FILE__)).'/method_identifier.php'; }elseif( ($item->BestMethod==TRUE && $item->MatchingMethod=='Name') && !isset($method) || $method=='name' ){ $flagBestMethod = TRUE; require_once realpath(dirname(__FILE__)).'/method_name.php'; }elseif( ($item->BestMethod==TRUE && $item->MatchingMethod=='PostCode') && !isset($method) || $method=='postcode' ){ $flagBestMethod = TRUE; require_once realpath(dirname(__FILE__)).'/method_postcode.php'; } //Affichage des propostions des méthodes de recherche if($item->MatchingMethod=='Keyword'){ $lien .= 'Par mots clés - '; } if($item->MatchingMethod=='Identifier'){ $lien .= 'Par identifiant - '; } if($item->MatchingMethod=='Name'){ $lien .= 'Par nom - '; } if($item->MatchingMethod=='PostCode'){ $lien .= 'Par Post Code - '; } } print ''.$lien.''; } ?>