0

Sorry for bad english. My website server ip cannot connect to my payment bank website and this script is:

$client = new nusoap_client('https://pgws.bpm.bankmellat.ir/pgwchannel/services/pgw?wsdl');

I need to connect to another server, than connect to the bank website.

For another server I use this script like proxy:

<?php header('Content-type: text/xml'); $file = file_get_contents('https://pgws.bpm.bankmellat.ir/pgwchannel/services/pgw?wsdl');echo $file;?> 

in seccond server & use my second directadmin host domain for this orginal url in my orginal script:

$client = new nusoap_client('http://seccond-host-domain.com');

But this gives many errors because this script transfer file and I think my ideas can't do this.

The error is:

HTTP Error: server failed to send headers

Some say should use curl and some one say use proxy server. But I have tried this and I can not resolve this problem. I'm out of ideas. Please see the detailed and clear instructions

My full script is:

<?php if ($_POST['PayRequestButton'] == 'settel') { SETTEL_PROCCES();} function SETTEL_PROCCES(){


require_once("./lib/nusoap.php");



    $client = new nusoap_client('https://pgws.bpm.bankmellat.ir/pgwchannel/services/pgw?wsdl');

    $namespace='http://interfaces.core.sw.bps.com/';

    $terminalId = $_POST['termID'];

    $userName = $_POST['username'];

    $userPassword = $_POST['password'];

    $orderId = $_POST['orderID'];

    $settleSaleOrderId = $_POST['orderID'];

    $settleSaleReferenceId = $_POST['ReferenceId'];





                        // Check for an error

                        $err = $client->getError();

                        if ($err) {

                            echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';

                            die();

                        }



                        $parameters = array(

                            'terminalId' => $terminalId,

                            'userName' => $userName,

                            'userPassword' => $userPassword,

                            'orderId' => $orderId,

                            'saleOrderId' => $settleSaleOrderId,

                            'saleReferenceId' => $settleSaleReferenceId);



                        // Call the SOAP method

                        $result = $client->call('bpSettleRequest', $parameters, $namespace);



                        // Check for a fault

                        if ($client->fault) {

                            echo '<h2>Fault05</h2><pre>';

                            print_r($result);

                            echo '</pre>';

                            die();

                        } 

                        else {

                            $resultStr = $result;



                            $err = $client->getError();

                            if ($err) {

                                // Display the error

                                echo '<h2>Error</h2><pre>' . $err . '</pre>';

                                die();

                            } 

                            else {

                                // Update Table, Save Settle Status 

                                // Note: Successful Settle means that sale is settled.

                                //echo "<script>alert('Settle Response is : " . $resultStr . "');</script>";

                            //  echo "Settle Response is : " . $resultStr;

                            }// end Display the result

                        }// end Check for errors    



    echo "

<br><br><br><br><br><br><br>

<center>

<table dir=rtl width=400 height=40 cellpadding=2 cellspacing=1 bgcolor='#7c931a'><tr><td bgcolor='#f6fff0' style='font-family:tahoma; font-size:12px; color:#738b3b; ' align=center >

<br>



<span style='font-size:14px;' >".check_mellat_state_error($resultStr)." 



<br><br>

<a href='default.php'>صفحه اصلي</a>

<br><br>

</td></tr></table>

</center>

";} function check_mellat_state_error($ResCode){

switch($ResCode){

    case '0' :

        $prompt="تراکنش با موفقيت انجام شد.";

        break;

    case '11' :

        $prompt="شماره کارت نامعتبر است.";

        break;

    case '12' :

        $prompt="موجودي کافي نيست.";

        break;

    case '13' :

        $prompt="رمز نادرست است.";

        break;

    case '14' :

        $prompt="تعداد دفعات وارد کردن رمز پيش از حد مجاز است.";

        break;

    case '15' :

        $prompt="کارت نامعتبراست.";

        break;

    case '17' :

        $prompt="کاربر از انجام تراکنش منصرف شده است.";

        break;

    case '18' :

        $prompt="تاريخ انقضاي کارت گذشته است.";

        break;

    case '111' :

        $prompt="صادرکننده کارت نامعتبر است.";

        break;

    case '112' :

        $prompt="خطاي سوييچ صادرکننده کارت";

        break;

    case '113' :

        $prompt="پاسخ از صادرکننده کارت دريافت نشد.";

        break;

    case '114' :

        $prompt="دارنده کارت مجاز به انجام اين تراکنش نيست.";

        break;

    case '21' :

        $prompt="پذيرنده نامعتبر است";

        break;

    case '22' :

        $prompt="ترمينال مجوز ارائه سرويس درخواستي را ندارد.";

        break;

    case '23' :

        $prompt="خطاي امنيتي رخ داده است.";

        break;

    case '24' :

        $prompt="اطلاعات کاربري پذيرنده نامعتبر است..";

        break;

    case '25' :

        $prompt="مبلغ نامعتبر است.";

        break;

    case '31' :

        $prompt="پاسخ نامعتبر است.";

        break;

    case '32' :

        $prompt="فرمت اطلاعات وارد شده صحيح نيست.";

        break;

    case '33' :

        $prompt="حساب نامعتبر است.";

        break;

    case '34' :

        $prompt="خطاي سيستمي";

        break;

    case '35' :

        $prompt="تاريخ نامعتبر است.";

        break;

    case '41' :

        $prompt="شماره درخواست تکراري است.";

        break;

    case '42' :

        $prompt="تراکنش sale يافت نشد.";

        break;

    case '43' :

        $prompt="قبلا درخواست verify داده شده است.";

        break;

    case '44' :

        $prompt="درخواست verify  يافت نشد.";

        break;

    case '45' :

        $prompt="تراکنش settle شده است.";

        break;

    case '46' :

        $prompt="تراکنش settle نشده است.";

        break;

    case '47' :

        $prompt="تراکنش settle يافت نشد.";

        break;

    case '48' :

        $prompt="تراکنش reverse شده است.";

        break;

    case '49' :

        $prompt="تراکنش refund يافت نشد.";

        break;

    case '412' :

        $prompt="شناسه قبض نادرست است.";

        break;

    case '413' :

        $prompt="شناسه پرداخت نادرست است.";

        break;

    case '414' :

        $prompt="سازمان صادرکننده قبض نامعتبر است.";

        break;

    case '415' :

        $prompt="زمان جلسه کاري به پايان رسيده است.";

        break;

    case '416' :

        $prompt="خطا در ثبت اطلاعات";

        break;

    case '417' :

        $prompt="شناسه پرداخت کننده نامعتبراست.";

        break;

    case '418' :

        $prompt="اشکال در تعريف اطلاعات مشتري";

        break;

    case '419' :

        $prompt="تعداد دفعات ورود اطلاعات از حد مجاز گذشته است.";

        break;

    case '421' :

        $prompt="IP نامعتبر است";

        break;

    case '51' :

        $prompt="تراکنش تکراري است.";

        break;

    case '52' :

        $prompt="سرويس درخواستي موجود نمي باشد.";

        break;

    case '54' :

        $prompt="تراکنش مرجع موجود نيست.";

        break;          

    case '55' :

        $prompt="تراکنش نامعتبر است.";

        break;

    case '61' :

        $prompt="خطا در واريز";

        break;                          

    DEFAULT :

        $prompt="خطاي نامشخص";

        break;

}

return  'کد ' . $ResCode .' : '. $prompt;

}?>
Charles
  • 50,943
  • 13
  • 104
  • 142

1 Answers1

0

Maybe allow-url-fopen is disabled?

Maybe fetching httpS via SSL doesnt work right when using file_get_contents()? As far as I know, that method is a very simple/dumb url fetcher

You could try setting a context for your file_get_contents call, with proper headers. See http://php.net/manual/en/function.file-get-contents.php#example-2320 for a start.

If you need more proper URL fetching control (and likely will if you need to fetch HTTPS pages), see the PHP manual pages on curl functions. @Marc B has a good link as a comment above, but you may not need the proxy parts (you might, it may depend on your webhost's setup)

There is more we could suggest if we had more details on what was happening, or more detail on the error.

Uberfuzzy
  • 8,253
  • 11
  • 42
  • 50