- 介绍
在PHP中实现调用WebService的话,有很多种方式:nusoap等。
- nusoap
[codesyntax lang="php"]
<?php
require_once('nusoap.php');
function login_from_webservice($name, $passwd)
{
$client = new nusoap_client('http://surenpi.com/SsoAuthUserProcess?wsdl', true);
$res = $client->getProxy()->process(array('userCode'=>$name, 'password'=>$passwd));
return (is_array($res) && 'Y' == $res['result']);
}
[/codesyntax]
上面是通过客户端调用WebService服务的一个例子。
以下是Ubuntu系统下安装nusoap库的命令:
apt-cache search nusoap
apt-get install libnusoap-php