我正在尝试将MantisBT API(通过插件)集成到我的WordPress网站中,并且在公司代理http://proxy:8080
的支持下。
我按照文档螳螂来获取必须对我而言的API链接:http://localhost:8181/api/soap/connectmantis.php?wsdl
当我将此链接放到浏览器中时,我可以阅读API文档-我想这就是它的显示内容-。
但是,当我在WordPress网站的代码中使用URL时,会引发以下错误:
Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from "http://localhost:8181/api/soap/mantisconnect.php' : failed to load external entity "http://localhost:8181/api/soap/mantisconnect.php"
以下是我的代码示例:
class connectMantis{
private $client = null;
function __construct(){
$username = 'myusername';
$password = 'mypassword';
$wsdl = 'http://localhost:8181/api/soap/mantisconnect.php?wsdl';
$connectionParams = array(
"authentication" => "SOAP_AUTHENTICATION_BASIC",
"login" => $username,
"password" => $password
);
$this->client = new SoapClient($wsdl, $connectionParams);
....
}
我想这可能是代理服务器,但我不知道如何进行。
我的docker映像出现网络故障,但是现在我将所有映像都放在同一局域网中,应该更好! 我仍然有wsdl错误,我根本不了解...
因此,当我将螳螂wsdl放入我的PHP代码中时,便可以访问它:
echo file_get_contents($wsdl);
但是当我尝试使用$this->client = new SoapClient($wsdl, $connectionParams);
上方显示的SoapClient时,出现了新错误。
这里是:Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from '/var/www/html/html/pages' : Document is empty ...
有人知道吗?