-4

I'm programming a homepage and I need to connect to JAVA and send some encrypted information to java and getting some back. How should I do this?

Benjamin Gruenbaum
  • 270,886
  • 87
  • 504
  • 504
bw2801
  • 321
  • 2
  • 8
  • 15

3 Answers3

3

Check out PHP's exec() command.

string exec ( string $command [, array &$output [, int &$return_var ]] )

It allows you to issue commands to the shell (such as a call to a Java program, etc.) and return results back to PHP.

Ian Atkin
  • 6,302
  • 2
  • 17
  • 24
2

Just give you an idea

  1. compile and build your JAVA program, and your program should accept command line arguments as input and write output to STDOUT (i.e. write to System.out using System.out.print and such.)
  2. Then, in PHP, use exec() to execute that jar file.
luiges90
  • 4,493
  • 2
  • 28
  • 43
0

Disclaimer: I assume you mean that you want to connect a PHP or Java Website to a PHP or Java Server.

Usually when to alien systems have to communicate to each other in a web context - "webservices" come in play. There you can use a SSL encrypted connection to send and receive messages/data.

The two Buzzwords you can investigate reading are REST and SOAP.

http://stackoverflow.com/questions/209905/rest-and-soap
madflow
  • 7,718
  • 3
  • 39
  • 54