访问链接(http://mef.com.pk/test/samples/test.php)
require_once('../lib/nusoap.php');
$client = new nusoap_client("http://miuc.com.pk/test/samples/test1.php");
$error = $client->getError();
if ($error) { echo "<h2>Constructor error</h2><pre>" . $error . "</pre>"; }
$result = $client->call("getProd", array("category" => "books"));
if ($client->fault) {
echo "<h2>Fault</h2><pre>";
print_r($result);
echo "</pre>";
}
else {
$error = $client->getError();
if ($error) {
echo "<h2>Error</h2><pre>" . $error . "</pre>";
}
else {
echo "<h2>Books</h2><pre>";
echo $result;
echo "</pre>";
}
}
现在转到另一个正在调用的链接。 (http://miuc.com.pk/test/samples/test1.php)
代码
require_once('../lib/nusoap.php');
function getProd($category) {
if ($category == "books") {
return join(",", array(
"The WordPress Anthology",
"Build Your Own Website the Right Way"));
}
else {
return "No products listed under that category";
}
}
$server = new soap_server();
$server->register("getProd");
$server->service($HTTP_RAW_POST_DATA);
现在运行http://mef.com.pk/test/samples/test.php
错误
HTTP错误:HTTP身份验证失败
请参见上面的代码。我尝试了许多更改,但仍收到错误。我非常感谢使用soap API从其他服务器获得的帮助。