为什么我的HTTP.call()没有按照需要POST到php文件?

时间:2017-07-13 14:44:30

标签: php meteor xmlhttprequest

如何正确使用Meteor #include将表单内容发布到PHP文件以进行进一步处理?

我当前的代码( server / main.js )使用HTTP.call() POST到远程PHP页面,但返回一条人类无法读取的错误消息。

在下面找到终端中返回的错误消息:

The error message I get in the Terminal after HTTP.call() Posting

所需的响应应该更像这样:

The desired response from the HTTP.call()

以下是我的远程PHP文件( http://2117c3a8.ngrok.io/TalkGateLane/escrow/c2b.php )的样子:

HTTP.call()

以下(在 server / main.js 中)是<? require_once "TalkGateLane.php"; //Specify your credentials $username = "DrOctogon"; $apiKey = "1c1f0df78c3b"; $gateway = new TalkGateLane($username, $apiKey, "sandbox"); $productName = "pesa"; // The 3-Letter ISO currency code for the checkout amount // Provide the details of a mobile money recipient $recipient = array( "phoneNumber" => $_POST['recipient'], "currencyCode" => "KES", "amount" => $_POST['amount'], "metadata" => array( "name" => "Something...", "reason" => "Som other thing..." ) ); $phoneNumber = $_POST['payer']; $currencyCode = "KES"; $amount = $_POST['amount']; $metadata = array( "name" => "Something...", "reason" => "Som other thing..." ); try { $transactionId = $gateway->initiateMobilePaymentCheckout($productName, $phoneNumber, $currencyCode, $amount, $metadata); $msg = 'The payment of ' . $currencyCode . ' ' . $amount . ' has been sent your account'; $gateway->sendMessage($_POST['recipient'] . ',' . $_POST['payer'], $msg); echo $msg; } catch (AfricasTalkingGatewayException $e) { echo "Received error response: " . $e->getMessage(); } ?> 的样子:

HTTP.call()

0 个答案:

没有答案