我正和一位朋友一起开展SOAP项目,我们对这个问题很感兴趣。
Error: The item has been sent!
Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in /home/eblanda/public_html/Shop/proceed.php:35
Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://logon.sa...', 'urn:TC#executeC...', 1, 0)
#1 /home/eblanda/public_html/Shop/proceed.php(35): SoapClient->__call('executeCommand', Array)
#2 /home/eblanda/public_html/Shop/proceed.php(35): SoapClient->executeCommand(Object(SoapParam))
#3 {main} thrown in /home/eblanda/public_html/Shop/proceed.php on line 35
使用端口7878,服务正在运行。
这是PHP文件
<?php
session_start();
include ("config/connect.php");
$total_price=$_POST['itemsprice'];
$itemid=$_POST['itemid'];
$charname=$_POST['charlist'];
$soapUsername = 'SHOP';
$soapPassword = 'XXXXX'; (Account Details are correct)
$soapHost = 'logon.sargeras.x24hr.com'; (Tried IP here as well, no cigar)
$soapPort = '7878';
$points=mysqli_query($auth, "SELECT * FROM vs_votepoints WHERE accid='{$_SESSION['SESS_MEMBER_ID']}'") or die(mysqli_error($auth));
while($row = mysqli_fetch_array($points)){
$vp=$row['ammount'];
}
if (@$vp < $total_price) {
echo "<b>Sorry you don't have enough Vote Points</b>";
}
else
{
$final=$vp-$total_price;
echo "<b>The item has been sent!</b>";
mysqli_query($auth, "UPDATE vs_votepoints SET ammount = '{$final}' WHERE accid='{$_SESSION['SESS_MEMBER_ID']}'");
$client = new SoapClient(NULL, array(
'location' => "http://$soapHost:$soapPort/",
'uri' => 'urn:TC',
'style' => SOAP_RPC,
'login' => $soapUsername,
'password' => $soapPassword,
));
echo "<table><tr>";
foreach( $itemid as $key => $n ) {
$command="send items {$charname} \"Thanks\" \"Thanks for doing this, here is your reward!\" {$n}";
$result = $client->executeCommand(new SoapParam($command, 'command'));
}
}
?>
非常感谢任何帮助:)