基本的に、フォームを印刷するページがあり、フォームに入力すると、ユーザーはサードパーティの支払いページにリダイレクトされます(データはxmlリクエストを介してサードパーティの支払いページに送信されます)。動作するはずの関数は次のとおりです。
function redirect_form()
{
global $pxpay;
$request = new PxPayRequest();
$http_host = getenv("HTTP_HOST");
$request_uri = getenv("SCRIPT_NAME");
$server_url = "http://$http_host";
#$script_url = "$server_url/$request_uri"; //using this code before PHP version 4.3.4
$script_url = "$server_url$request_uri"; //Using this code after PHP version 4.3.4
#$script_url = (version_compare(PHP_VERSION, "4.3.4", ">=")) ?"$server_url$request_uri" : "$server_url/$request_uri";
$MerchantReference = $_REQUEST["Reference"];
$StudentName = $_REQUEST["x_name"];
$Venue = $_REQUEST["x_venue"];
$Course = $_REQUEST["x_course"];
$AmountInput = $_REQUEST["x_amount"];
$Currency = $_REQUEST["x_currency"];
$Email = $_REQUEST["x_email"];
#Generate a unique identifier for the transaction
$TxnId = uniqid("ID");
#Set PxPay properties
$request->setMerchantReference($MerchantReference);
$request->setAmountInput($AmountInput);
$request->setTxnData1($StudentName);
$request->setTxnData2($Venue);
$request->setTxnData3($Course);
$request->setTxnType("Purchase");
$request->setCurrencyInput($Currency);
$request->setEmailAddress($Email);
$request->setUrlFail($script_url); # can be a dedicated failure page
$request->setUrlSuccess($script_url); # can be a dedicated success page
$request->setTxnId($TxnId);
#The following properties are not used in this case
# $request->setEnableAddBillCard($EnableAddBillCard);
# $request->setBillingId($BillingId);
# $request->setOpt($Opt);
#Call makeRequest function to obtain input XML
$request_string = $pxpay->makeRequest($request);
#Obtain output XML
$response = new MifMessage($request_string);
#Parse output XML
$url = $response->get_element_text("URI");
$valid = $response->get_attribute("valid");
#Redirect to payment page
header("Location: ".$url);
}
このフォームは、$ _ REQUESTを使用する場合、サンプルコードで完全に機能し、各変数が定義されている部分をコメントアウトすると、フォームは完全に送信されます。各変数も文字列です。
変数をプレーンテキストとして定義してテストを行いましたが、それでも機能します。
この関数は次の人によって呼び出されています:
if (isset($_POST['StudentName'])) { redirect_form(); }
問題は、ページが単に空白のページに移動することです。支払いページに移動する必要があります。
任意の提案をいただければ幸いです。
編集:-PHPエラーレポートは次のことを示しています:
Warning: Cannot modify header information - headers already sent by (output started at /home/becky/public_html/paymentconfirmation.php:244) in /home/becky/public_html/paymentconfirmation.php on line 288
244行目は次のとおりです。
$MerchantReference = $_REQUEST["Reference"];
行288はヘッダー呼び出しです。
header("Location: ".$url);
私が理解していないのは、この問題は、フォームへの入力を開始したセッションがすでに存在する場合にのみ発生するということです(必要なもの)。このページでセッションを開始しても問題ありません。
これが単純な問題である場合はご容赦ください-解決されたが苦労した同様の問題を見つけようとしました