advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Download the code for this article
Partners & Affiliates
advertisement
advertisement
advertisement
Average Rating: 3.2/5 | Rate this item | 9 users have rated this item.
 

Cross the Gap Between PHP and Java

Using sophisticated application frameworks to build your network server applications is fine, but sometimes these frameworks are overkill. With a little communications programming between PHP and Java, you can establish an extensible layer that handles the annoying details of creating a custom network protocol. 


advertisement
hese days, using sophisticated application frameworks to build your network server applications is understandable, but sometimes such frameworks are overkill. When you strip networking down to its bare essentials, network sockets offer lot of flexibility and simplicity. With a little communications programming between PHP and Java, you can establish an extensible layer that handles the annoying details of creating a custom network protocol.


As you'll see, PHP is not only excellent for quick-and-dirty scripting. More and more developers also are using it to build sophisticated Web applications. Java, of course, has been used to build Web applications for years, but as anyone who has used a Java-based Web framework knows, it isn't the easiest technology to use.

This article shows how to connect a PHP-based application to a custom Java server. The demonstration doesn't use Enterprise Java Beans (EJB) or any particular Java-based server framework. Instead, it creates a simple custom TCP/IP Java server to demonstrate how easy it is. Then, you'll see how to access such a server from Java.

Architecture
PHP programming is sometimes mistakenly referred to as client-side scripting. Technically, PHP runs on the server side, but because it is usually used to generate HTML—which the user sees directly—it is sometimes thought of as the client-side portion of server-side code.

In fact, the system in this article uses PHP in this very sense (click here to download the source code). It consists of a Java portion, which performs server-side computation, and a PHP portion, which generates HTML. Both portions run on the server and communicate using a TCP/IP socket. The terms client and server can be a little ambiguous in this context, so the article refers instead to the PHP portion and the Java portion.

  Next Page: The Java and PHP Portions


Page 1: IntroductionPage 3: Data Structures
Page 2: The Java and PHP PortionsPage 4: A Mechanism for Ad-hoc Remote Procedure Calls
Please rate this item (5=best)
 1  2  3  4  5
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs