4

嗨,我的支付网关有问题,当工作在网关中完成并通过下面的编码返回到该文件时

 <?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>';
  ?>

我正面临以下错误

致命错误:未捕获的 SoapFault 异常:[soap:Client] 服务器无法读取请求。---> XML 文档中存在错误 (2, 235)。---> 输入字符串的格式不正确。在 /home/travianx/public_html/ts1/parspal.php:53 堆栈跟踪:#0 /home/travianx/public_html/ts1/parspal.php(53): SoapClient->__call('VerifyPayment', Array) #1 / home/travianx/public_html/ts1/parspal.php(53): SoapClient->VerifyPayment(Array) #2 {main} 在第 53 行的 /home/travianx/public_html/ts1/parspal.php 中抛出

我联系了我的付款支持,他们说我必须提供访问权限:http ://merchant.parspal.com/WebService.asmx?wsdl

而且我不知道他们是怎么说的以及怎么说的!请帮我!我有 vps 和 cpanel 安装在它上面

4

3 回答 3

8

您需要捕获您的 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
}
于 2013-01-05T17:51:36.030 回答
0

在我的情况下,服务器无法访问(IP 受限),并且来自 Web 服务的标准错误页面有一些 DTD 标头:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

删除 ip 访问限制(项目仍在开发中)解决了问题;)

于 2018-10-20T11:34:30.600 回答
-2

我解决了这个问题,只需要在你的 webservice php 代码末尾避免空格

<?php

.. (my php webservice)
.. (some code)
..

$server->service($POST_DATA);
exit();
?>**(here have an space or enter who cause this problem)**
于 2014-08-27T04:44:36.070 回答