batch/1.1/old/wsAssoClient.php

66 lines
2.9 KiB
PHP
Raw Normal View History

#!/usr/bin/php
<?
error_reporting(E_ALL);
ini_set('soap.wsdl_cache_enabled', 0);
$client = new SoapClient('http://extranet.scores-decisions.com/ws/asso/asso.wsdl',
array( 'trace' => 1, 'soap_version' => SOAP_1_1,
'login' => 'TESTASSOSYSPERTEC', 'password' => 'TESTPW'));
$argv=$_SERVER['argv'];
switch ($argv[1]) {
case 'recherche':
try {
$O = $client->rechercheAsso($argv[2], @$argv[3], @$argv[4], @$argv[5]);
if ($O->error->errnum)
echo 'Erreur : '. $O->error->errmsg .' ('. $O->error->errnum .")\n";
else
foreach ( $O->results as $num=>$val ) {
echo $num .'. '. (string)$val->nomAssociation ."\n";
echo 'Identifiant S&D : '. $val->idAssociation ."\n";
if ($val->siret<>0) echo 'Siret : '. $val->siret."\n";
echo 'Adresse1 : '. $val->adresseNum .' '. $val->adresseIndRep .' '.
$val->adresseTypVoie .' '. $val->adresseLibVoie ."\n";
echo 'Adresse2 : '. $val->adresseComp ."\n";
echo 'Adresse3 : '. $val->adresseCodePostal .' '. $val->adresseVille ."\n";
echo 'Préfecture du département n°'. $val->departement ."\n\n";
}
echo $client->__getLastRequest()."\n";
echo $client->__getLastResponse()."\n";
} catch (SoapFault $fault) {
echo 'ERREUR SOAP :'.EOL;
print_r($fault);
echo $client->__getLastRequest()."\n";
echo $client->__getLastResponse()."\n";
}
break;
case 'identite':
try {
$O = $client->identiteAsso($argv[2]);
if ($O->error->errnum)
echo 'Erreur : '. $O->error->errmsg .' ('. $O->error->errnum .")\n";
else {
$val=$O->result;
echo 'Nom : '. (string)$val->nomAssociation ."\n";
echo 'Identifiant S&D : '. $val->idAssociation ."\n";
if ($val->siret<>0) echo 'Siret : '. $val->siret."\n";
echo 'Adresse1 : '. $val->adresseNum .' '. $val->adresseIndRep .' '.
$val->adresseTypVoie .' '. $val->adresseLibVoie ."\n";
echo 'Adresse2 : '. $val->adresseComp ."\n";
echo 'Adresse3 : '. $val->adresseCodePostal .' '. $val->adresseVille ."\n";
echo 'Préfecture : '. $val->prefecture .' ('. $val->departement .")\n";
echo 'Activité : '. $val->activite ."\n";
echo 'Site Web : '. $val->siteWeb ."\n";
echo 'E-mail : '. $val->email ."\n";
echo 'Objet : '. $val->objet ."\n";
echo $client->__getLastRequest()."\n";
echo $client->__getLastResponse()."\n";
}
} catch (SoapFault $fault) {
echo 'ERREUR SOAP :'.EOL;
print_r($fault);
}
break;
}
?>