在php中发布对外部URL的响应

时间:2014-04-29 18:30:48

标签: php forms post response payment

我有一个网站,我收到付款处理器发出的付款响应。我的页面是https,而我的客户页面却没有。

我以这种方式发布付款回复

echo '<html>Redirecting to merchants website..<body>
<form id="myForm" action="'.$response_url.'" method="POST">
<input type="hidden" name="status" value="'.$response['status'].'"/>
<input type="hidden" name="customerReferenceNo" value="'.$data['customerReferenceNo'].'"/>
<input type="hidden" name="amount" value="'.$data['amount'].'"/>
<input type="hidden" name="paymentMode" value="'.$data['paymentMode'].'"/>
<input type="hidden" name="cardProvider" value="'.$data['cardProvider'].'"/>
<input type="hidden" name="orderID" value="'.$orderID.'"/>
<input type="hidden" name="mobileNo" value="'.$mobileNo.'"/>
<input type="hidden" name="email" value="'.$email.'"/>
</form>

<script>document.getElementById("myForm").submit();</script></body></html>';

作为一个隐藏的表单post.But当我将值从https发布到http页面时,它在某些浏览器中弹出安全警告:

  

虽然此页面已加密,但您输入的信息仍将被发送   通过未加密的连接,可以很容易地被第三方阅读。

     

您确定要继续发送此信息吗?

我想知道这是否是将回复发布到外部网址的正确方法?我正在做的是对的吗?我应该将付款响应发布到外部网址吗?

请帮忙提出一些建议

1 个答案:

答案 0 :(得分:0)

如上面的评论所述,您一定要注意回发到https网站。但是,不是将隐藏的表单输出到浏览器并从那里发布,而是使用curl更好,因此将数据直接从服务器发送到支付处理器。 见curl_exec in php documentation