嗨,我有一个问题与我的支付网关,当工作在网关完成,它返回到这个文件通过下面的编码
<?php
include("app/config.php");
$db_connect = mysql_connect($AppConfig['db']['host'],$AppConfig['db']['user'],$AppConfig['db']['password']);
mysql_select_db($AppConfig['db']['database'], $db_connect);
$rest=mysql_query("SELECT * FROM p_players WHERE player_type=2" );
$rowa = mysql_fetch_assoc($rest);
$nameadmin=$rowa['name'];
$idadmin=$rowa['id'];
// Form Content
echo '<html dir="rtl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
.title
{
height:30px;
}
input
{
font-family:tahoma;
}
</style>
</head>
<body style="font-family:tahoma;line-height:30px">';
//echo $this->package['cost'].'--'.$AppConfig['plus']['packages'][0]['cost'];
// echo $st[1];
// echo $AppConfig['plus']['payments']['paypal']['merchant_id'];
if(isset($_POST['status']) && $_POST['status'] == 100){
$Resnumber = $_POST['resnumber'];
$Refnumber = $_POST['refnumber'];
$info = split("_",$Resnumber,2);
$UID = $info[0];
$PgID = $info[1];
$MerchantID = $AppConfig['plus']['payments']['paypal']['merchant_id'];
$Password = $AppConfig['plus']['payments']['paypal']['key'];
$Price = $AppConfig['plus']['packages'][$PgID]['cost'];
$client = new SoapClient('http://merchant.parspal.com/WebService.asmx?wsdl');
$res = $client->VerifyPayment(array("MerchantID" => $MerchantID , "Password" =>$Password , "Price" =>$Price,"RefNum" =>$Refnumber ));
$Status = $res->verifyPaymentResult->ResultStatus;
$PayPrice = $res->verifyPaymentResult->PayementedPrice;
if($Status == 'success')// Your Peyment Code Only This Event
{
$result = mysql_query("SELECT * FROM p_players WHERE id='$UID'");
while($row = mysql_fetch_array($result)){
$idplayer=$row['id'];
$nameplayer=$row['name'];
$goldb=$AppConfig['plus']['packages'][$PgID]['gold'];
$subject="خريد با موفقيت";
$sendsms="خريد شما با موفقيت انجام شد و تعداد $goldb طلا به حسابتان واريز گرديد . با تشکر از خريدتان - شماره رسيد پرداخت $Refnumber";
$Codemaker=rand(10000,200000000);
$goldenb=0;
mysql_query("UPDATE p_players SET gold_num = gold_num + '$goldb',new_mail_count=new_mail_count+1,codemaker='$Codemaker',goldb='$goldenb' where id='$idplayer' ") or die(mysql_error());
mysql_query("INSERT INTO `p_msgs` (`from_player_id`, `to_player_id`, `from_player_name`, `to_player_name`, `msg_title`, `msg_body`, `creation_date`, `is_readed`, `delete_status`) VALUES( '$idadmin', '$idplayer', '$nameadmin', '$nameplayer', '$subject', '$sendsms', now(), 0, 0)");
}
echo '<div style="color:green">
بازگشت از عمليات پرداخت، با موفقيت انجام شد.
<br />
شماره رسيد : '.$_POST['refnumber'].'
<br/>
<a href="http://'.$_SERVER['SERVER_NAME'].'">مشاهده سايت</a></div>';
exit();
}
else {
echo '<div style="color:red">
شماره رسيد صحيح نمي باشد . '.$Status.'
<br />
شماره رسيد : '.$_POST['refnumber'].'
<br/>
<a href="http://'.$_SERVER['SERVER_NAME'].'">مشاهده سايت</a></div>';
exit();
}
}
if(isset($_POST['status'])){
echo '<div style="color:red">
بازگشت از عمليات پرداخت، خطا در انجام عمليات پرداخت ( پرداخت ناموق ) !
<br />
<a href="http://'.$_SERVER['SERVER_NAME'].'">مشاهده سايت </a></div>';
exit();
}
echo '</body>
</html>';
?>
我遇到以下错误
Fatal error: Uncaught SoapFault exception: [soap:Client] Server was able to read request。在XML文档(2,235)中有一个错误。输入字符串格式不正确。/home/traviax/public_html/ts1/parspal.php(53): SoapClient->__call('VerifyPayment', Array) #1/home/traviax/public_html/ts1/parspal.php(53): SoapClient->VerifyPayment(Array) #2 {main}抛出在/home/traviax/public_html/ts1/parspal.php第53行
我联系了我的付款支持,他们说我必须访问这个:http://merchant.parspal.com/WebService.asmx?wsdl
我不知道他们怎么说,怎么说!请帮帮我!我有VPS和cpanel安装在它上面
您需要捕获Soap客户端错误,它们通常会返回更格式化的内容:
try{
$client = new SoapClient('http://merchant.parspal.com/WebService.asmx?wsdl');
$res = $client->VerifyPayment(array("MerchantID" => $MerchantID , "Password" =>$Password , "Price" =>$Price,"RefNum" =>$Refnumber ));
}catch (SoapFault $e){
print_r($client);
// or other error handling
}
在我的例子中,服务器不可访问(ip受限制),并且来自web服务的标准错误页有一些DTD头:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
取消ip访问限制(项目仍在开发中)解决了问题;)
我解决了这个问题,只需要避免在你的webservice php代码末尾的空间
<?php
.. (my php webservice)
.. (some code)
..
$server->service($POST_DATA);
exit();
?>**(here have an space or enter who cause this problem)**