我知道这已经被问到了,但之前的帖子并没有帮助我解决这个问题。
完全错误:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://XXX-XXX-XXX.mktoapi.com/soap/mktows/2_5?WSDL' : failed to load external entity "http://XXX-XXX-XXX.mktoapi.com/soap/mktows/2_5?WSDL" in /home1/jameszei/public_html/index.php:84 Stack trace: #0 /home1/jameszei/public_html/index.php(84): SoapClient->SoapClient('http://XXX-XXX-...', Array) #1 {main} thrown in /home1/jameszei/public_html/index.php on line 84
我必须提取一些信息,因为这是安全的。但我保证WSDL可以通过我的浏览器访问。
我已经更新了php.ini文件,如下所示:
启用:
file_uploads = On
allow_url_fopen = On
allow_url_include = On
default_socket_timeout = 360
extension=php_bz2.dll
extension=php_curl.dll
extension=php_openssl.dll
extension=php_soap.dll
extension=php_sockets.dll
我有以下代码:
<?php
$cookieVal = $_COOKIE["_mkto_trk"];
echo $cookieVal;
$debug = true;
$marketoSoapEndPoint = "http://XXX-XXX-XXX.mktoapi.com/soap/mktows/2_5";
$marketoUserId = "hidden";
$marketoSecretKey = "hidden";
$marketoNameSpace = "http://www.marketo.com/mktows/";
// Create Signature
$dtzObj = new DateTimeZone("America/Los_Angeles");
$dtObj = new DateTime('now', $dtzObj);
$timeStamp = $dtObj->format(DATE_W3C);
$encryptString = $timeStamp . $marketoUserId;
$signature = hash_hmac('sha1', $encryptString, $marketoSecretKey);
// Create SOAP Header
$attrs = new stdClass();
$attrs->mktowsUserId = $marketoUserId;
$attrs->requestSignature = $signature;
$attrs->requestTimestamp = $timeStamp;
$authHdr = new SoapHeader($marketoNameSpace, 'AuthenticationHeader', $attrs);
$options = array("connection_timeout" => 200, "location" => $marketoSoapEndPoint);
if ($debug) {
$options["trace"] = true;
}
// Create Request
$leadKey = array("keyType" => "COOKIE", "keyValue" => $cookieVal);
$leadKeyParams = array("leadKey" => $leadKey);
$params = array("paramsGetLead" => $leadKeyParams);
$client = new SoapClient($marketoSoapEndPoint.'?WSDL', $options);
echo "good<br/>"; //This never happens since the above line fails
try {
$lead = $client->__soapCall('getLead', $params, $options, $authHdr);
echo "goodTry<br/>";
}
catch(Exception $ex) {
var_dump($ex);
}
if ($debug) {
print "RAW request:\n" .$client->__getLastRequest() ."\n";
print "RAW response:\n" .$client->__getLastResponse() ."\n";
}
echo $lead;?>
我很难过。这是我的网络主机的某种配置吗?我使用bluehost来托管我的页面。 php的默认值似乎是他们负责所有的安装。我使用5.4单个ini。
我是否需要下载.dll文件并将其安装在服务器上或主机上的目录中?我似乎只能限制在服务器上安装任何东西,但我可以确定是否需要。
感谢您的帮助。
我决定只下载xml并将其保存为我域上的wsdl。我现在收到一个新错误:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't find
<definitions> in '/home1/jameszei/public_html
这似乎很奇怪,因为这是wsdl的前几行:
<definitions>
<types>
<schema>
<!-- ***************************************************************** -->
<!-- ** Enumerations ** -->
<!-- ***************************************************************** -->
<simpleType name="LeadKeyRef">
<restriction base="string">
<enumeration value="IDNUM"/>
<enumeration value="COOKIE"/>
<enumeration value="EMAIL"/>
<enumeration value="LEADOWNEREMAIL"/>
<enumeration value="SFDCACCOUNTID"/>
<enumeration value="SFDCCONTACTID"/>
<enumeration value="SFDCLEADID"/>
<enumeration value="SFDCLEADOWNERID"/>
<enumeration value="SFDCOPPTYID"/>
</restriction>
</simpleType>
<simpleType name="LeadSyncStatus">
<restriction base="string">
<enumeration value="CREATED"/>
<enumeration value="UPDATED"/>
<enumeration value="FAILED"/>
</restriction>
</simpleType>
我很确定拼写正确。我有一种感觉,这是某种其他错误。
感谢任何帮助。
答案 0 :(得分:0)
解决:
这是我的终端 - 它没有设置任何DNS(grrrrr)。更新了我的机器上的主机文件,改为使用WAMP,现在我可以完全访问。