开发者

Ajax from PHP box to PHP box

I have always thought of Ajax as JS on the client communicating with PHP on the server.

Now, let's suppose I introduce and extra tier into that model, such that I have a central server which communicates with a bunch of regional servers with which the end users communicate.

Can I use Ajax to 开发者_JS百科communicate between the central server and the regional servers?

Is it possible? Does it even make sense? Should I be considering a different communications protocol?


Ajax will communicate with any file on a publicly available web server. If you wanted to throw another tier into that mix, as long as both servers are publicly available, you could theoretically write PHP scripts on both servers and communicate with both of them.

However, let's say your tier'ed system looks like this:

Ajax Script -> Central Server (internet) -> Regional Server (intranet)

Your ajax script can communicate with the Central Server, but not the Regional Server. At least, not directly. As long as the firewall on the Regional Server permits the Central Server to communicate with it, you could write a script on the Regional Server to do what you need to do and return the results to another script on the Central Server you wrote that acts as a proxy. Your ajax script would then communicate with the Central Server which would communicate with the Regional Server on your behalf. Of course, if this is sensitive data, you'd want to do this over SSL.

Is that the kind of answer you were looking for?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜