Zend Framework: How to POST data to some external page (e.g. external payment gate) without using form?

浪子不回头ぞ 提交于 2019-12-21 20:42:59

问题


I would like to have a user redirected to an external credit card gate. Of course I have to POST some user info to that gate, but I don't know how exactly can I do this.

I know that I could do this by generating a html form with hidden or read-only fields and have a user click "Submit" button. But this solution is not perfect, because all the form data could be easily changed using e.g. Firebug. I think you cannot do this using $this->_redirect(...). But maybe there is some other solution?

Many thanks for any tips or suggestions.


回答1:


I would like to have a user redirected to an external credit card gate. Of course I have to POST some user info to that gate, but I don't know how exactly can I do this.

Using a form is the only method available. The RFC states that the user should explicitly agree to sending a POST (i.e. click on a submit button).

I know that I could do this by generating a html form with hidden or read-only fields and have a user click "Submit" button. But this solution is not perfect, because all the form data could be easily changed using e.g.

It is no more secure that using a redirect as the header data can be modified without too much of a problem. There are even Firefox plugins to do it.




回答2:


use cURL to post data

http://framework.zend.com/manual/en/zend.http.client.adapters.html



来源:https://stackoverflow.com/questions/2252447/zend-framework-how-to-post-data-to-some-external-page-e-g-external-payment-ga

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!