PHP code example of chenall / phalapi-soap
1. Go to this page and download the library: Download chenall/phalapi-soap library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
chenall / phalapi-soap example snippets
return array(
/**
* 扩展类库 - SOAP配置
* @see SoapServer::__construct ( mixed $wsdl [, array $options ] )
*/
'wsdl' => NULL,
'options' => array(
'uri' => 'http://localhost/soap.php',
'port' => NULL,
),
);
// $ vim ./Public/soap.php
/**
* 统一访问入口
*/
;
$server->response();
$url = 'http://api.phalapi.net/shop/soap.php';
$params = array('servcie' => 'Welcome.Say');
try {
$client = new SoapClient(null,
array(
'location' => $url,
'uri' => $url,
)
);
$data = $client->__soapCall('response', array(json_encode($params)));
//处理返回的数据。。。
var_dump($data);
}catch(SoapFault $fault){
echo "Error: ".$fault->faultcode.", string: ".$fault->faultstring;
}
$ ./Library/SOAP/check.php http://api.phalapi.net/shop/soap.php "service=Welcome.Say"
array(3) {
["ret"]=>
int(200)
["data"]=>
string(11) "Hello World"
["msg"]=>
string(0) ""
}
$data = $client->__soapCall('response', array(json_encode($params)));