Connecting Tech Pros Worldwide Help | Site Map

Calling java program from PHP?

Dan Gelder
Guest
 
Posts: n/a
#1: Dec 24 '05
Hi, I'm new to PHP but learning fast. I'm already a Java programmer and
was wondering if there is a way to have a PHP script pass parameters to
a Java program and put the data back into the page.

Thanks In Advance
Merry Christmas
Dan

Iván Sánchez Ortega
Guest
 
Posts: n/a
#2: Dec 25 '05

re: Calling java program from PHP?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan Gelder wrote:
[color=blue]
> Hi, I'm new to PHP but learning fast. I'm already a Java programmer and
> was wondering if there is a way to have a PHP script pass parameters to
> a Java program and put the data back into the page.[/color]

Try something like:

<?php

$parameter1='foo';
$parameter2='bar';
$parameter3='quux';

$output = shell_exec("java whatever.jar $parameter1 $parameter2
$parameter3");

echo $output;

?>


- --
- ----------------------------------
Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net

Lo que importa es cuanto amor ponemos en el trabajo que realizamos.
-- Madre Teresa de Calcuta. (1910-1997) Misionera yugoslava
nacionalizada india.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDrgD23jcQ2mg3Pc8RAn1gAJwPTpcY0Y4fEACEUWxGhp dtJ+FIwACcCkvy
Qg0x2pfpquyz0T0gj7nPn8g=
=YHtJ
-----END PGP SIGNATURE-----
Closed Thread