extranet/includes/giant/client.php
2010-10-08 12:31:59 +00:00

44 lines
1.5 KiB
PHP

<?php
// --------------------------------------------------------------------------- //
// getProviderId
// --------------------------------------------------------------------------- //
function getProviderId($pays)
{
switch ($pays) {
case 'BE': return '001';
case 'NL': return '003';
default:
print 'Erreur sur le pays';
exit;
}
}
// --------------------------------------------------------------------------- //
// getClient
// --------------------------------------------------------------------------- //
function getClient($pays, $service)
{
$service_header = new StdClass;
$service_header->ConsumerId = '006';
$service_header->Provider = new StdClass;
$service_header->Provider->CountryCode = $pays;
$service_header->Provider->ProviderId = getProviderId($pays);
$service_header->TimeStamp = date('Y-m-d\TH:i:s');
$service_header->TestIndication = true;
$soap_header =
new SoapHeader('http://services.giant-net.com/'.
'schema/services/shared/1.0',
'ServiceHeader', $service_header);
$soap_client =
new SoapClient('https://giant-tst.graydon.nl/'.$service.'/v1?wsdl',
array('soap_version' => SOAP_1_1,
'login' => '006',
'password' => 'ClaudeMonet',
'trace' => true));
$soap_client->__setSoapHeaders($soap_header);
return $soap_client;
}
?>