开发者

GET webdata from a different network

Assume that there have 3 servers (A, B and C):

  • Server A can access server B only, and A is not able to access C directly.
  • B can access C.
  • A, C are in a separate network.

Both B and C are http servers, but only C can run PHP.

I have to use PHP to get some information from MySQL server in C from A, is it possible to 开发者_StackOverflow中文版do so?

I cannot install PHP to B.

Is it possible to write a PHP page that will run in C and return the result to B and back to A?


Configure B to act as a proxy. If it runs Apache then see the proxypass directive


You need to get B to act as a proxy. The idea being that you just route requests received to B directly to C.

Overview... and you want to get information, which resides on C to A.

BEFORE

(HTTP,PHP) A -----> B (HTTP,PHP)
(HTTP,PHP) A --||   C (HTTP,MySQL)
(HTTP,PHP) B -----> C (HTTP, MySQL)

After

(HTTP,PHP)            A -----> B (HTTP->ProxyPass,PHP)
(HTTP,PHP)            A --||   C (HTTP,MySQL)
(HTTP->ProxyPass,PHP) B -----> C (HTTP, MySQL)

A->B(Proxied to)->C

http://httpd.apache.org/docs/2.1/mod/mod_proxy.html#proxypass

Docs

Suppose the local server has address http://example.com/; then

ProxyPass /mirror/foo/ http://backend.example.com/

will cause a local request for http://example.com/mirror/foo/bar to be internally converted into a proxy request to http://backend.example.com/bar.


I didn't understand what you meant by 'from mysql server in C from A'. I am assuming you mean transferring MySQL data from A to C since A is not an HTTP server(you mentioned only B and C are). You can route a random port let's say 3310 on B to port 3306 on A, this way you will be able to access A's MySQL server directly from C(you would have to enable remote access on A though). I am assuming you have administrator rights on the 3 servers.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜