14 Java and COMThis is NOT the latest copy of this book; click here for the latest version.
While there are a large number of extensions available for PHP, a particular few stand out because they are technology extensions as opposed to just library extensions. That is, they allow you to make use of a particular technology from inside PHP, as if you were using it directly.
The most interesting of these extensions are the Java and COM extensions, because they give you a very simple interface into these powerful technologies, allowing you to make use of their functionality without straying too far away from PHP. Java, particularly, is seen as being an interesting match for PHP because they are both cross-platform, and both Internet-based.
Microsoft's Component Object Model (COM) system is available for Windows only, so Unix users will need to get by with just Java. If you are using Windows, and do not mind restricting your scripts to Windows only, then you can have lots of fun exploring how COM and PHP can fit together.
This chapter is devoted to exploring how you can mix in these two popular buzzwords with PHP - not just on a theoretical, "look what I can do" level, but also for practical benefit in your scripts. PHP is a great language, but you should never let that stop you from taking bits and pieces from other technologies wherever it will improve your scripts. Having said that, I like trying things out - even crazy things - for kicks now and then, and I hope that's been reflected here too.
Topics covered in this chapter are:
-
How to use COM
-
Finding out what components you have installed
-
Advanced COM - controlling Internet Explorer, and even writing VBScript
-
Distributed COM: COM over a network
-
Running Java in your scripts
-
Creating interfaces with Swing
Chapter contents14.1. Getting started with COM
14.1.1. Instantiating an object
14.1.2. Basic COM
14.1.3. Advanced COM
14.1.4. The possibilities of COM
14.1.5. DCOM
14.1.6. Microsoft .NET
14.2. Bringing Java into the mix
14.2.1. Basic Java use
14.2.2. The drawbacks of basic Java use
14.2.3. Your own classes
14.2.4. Using Swing
14.2.5. The future of PHP and Java
14.3. Summary
14.4. Exercises
14.5. Further reading
14.6. Next chapter
|
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.
My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!
|