开发者

Apache server sending http request to another server with php

Scena开发者_运维百科rio: I have two apache web servers with individual address. Say www.server1.com and www.server2.com.

For example: if a user login into server1.com and fill in a form and that transfers some information to server2.com and redirects him to server2.com

Real life example: Merchant websites which redirects users to payment gate way. and data transferred to gateway server is the amount to be paid. After payment the gateway server sends the transaction id to merchant website and redirect user back.


My Question: how does server1.com sends a http request from that server to server2.com . and that request can be GET or POST whatever that i describe. and it should be invisible to the user.

Note: Server i use is ubuntu. I have full access to the server, if any modules to be installed no problem. Code i use is PHP.


The webservers don't do the connections. It's the PHP code that does so. The standard methods is to use CURL. However, in some cases, the form that was served up server1 might actually just submit directly to server2. It all depends on the merchant's payment setup.


Shouldn't you just redirect the user towards the payment provider? I would not want to enter payment information on a site where the URL starts with "http://www.yoursite.com/payment", I want to enter that data to my credit card company's or bank's site and want visual confirmation that I am there by looking at the address bar.

Ontopic: you could use CURL to redirect the request, or use mod_proxy to let Apache handle all proxying for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜