如何促进服务器上的php脚本与另一台服务器上正在运行的Java应用程序之间的通信? [英] How to facilitate communication between php script on a server to a running Java application on another server?

查看:154
本文介绍了如何促进服务器上的php脚本与另一台服务器上正在运行的Java应用程序之间的通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为Java应用程序建立一种监听php发送数据的方法?套接字或Http POST?

How to establish a way for Java application to listen to data being sent by php ? Sockets or Http POST ?

基本上,我在其他服务器上运行Java应用程序,等待在其他服务器上运行的PHP脚本发送的某些字符串数据。

Essentially, I have Java application running on another server waiting for certain string data sent by PHP script running on other server.

任何图书馆建议或示例代码都将受到赞赏。

Any library suggestions or example codes will be appreciated.

推荐答案

您最好的选择可能是要设置一个java servlet容器(服务器),比如tomcat(你可以为其他东西付出很多钱,如果你必须出于公司原因)。

Your best bet is probably going to be to set up a java servlet "container" (server), such as tomcat (you can pay a lot of money for something else, if you have to for corporate reasons).

http://tomcat.apache.org/

http:// tomcat。 apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletRequest.html#getReader ()

http://tomcat.apache.org/ tomcat-5.5-doc / servletapi / javax / servlet / ServletRequest.html#getInputStream ()

请注意前面有一些工作,只是设置和托管hello.jsp,但在web.xml中添加myserviceservlet的映射不是坏。

Be aware there is a bit of work up front, just to set up and host "hello.jsp", but adding the mapping for the "myservice" servlet in web.xml is not too bad.

这篇关于如何促进服务器上的php脚本与另一台服务器上正在运行的Java应用程序之间的通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆