Monday, July 14, 2008

How to use web service in PHP 5.1.6. Part -> 2

In my previous post i describe how to create a web service and how to used in asp.net? In this post i used my web service in php.

First i create one page in php.
include_once('xmlparsefunction.php');

$client = new soapclient
(
'http://yourservername/web/getinvoicestatus/getinvoicestatus.asmx?WSDL',
array( 'trace' => true,
'exceptions' => true,
)
);

$param = array('strUserName' => 'aaa','strPassword' => 'bbb','strSecurityCode' => 'ccc');

$rs1 = $client->__call('getcompanyservice',array($param));

$result['getcompanyserviceResult']=$rs1->getcompanyserviceResult;

$rs = xml2array(htmlspecialchars($result['getcompanyserviceResult']));
print_r($rs)
?>