Jump to content

calling java classes using PHP


rhiegen

Recommended Posts

Hi there,

 

I've made a Java class and put the .class file in the same folder my .php is. Then I tried to call my java class in the way below without any success, but also without any error notice.

 

echo '<pre>';

 

  echo $host;

  $output = array("dns_ip_number_here","A","www_domain_here");

  $return_var = "";

  exec("java NsLookup $output);

 

  $output_str = join($output, "\n");

 

  echo "<pre>The output was:\n$output_str\n\n";

  echo "The return value was $return_var</pre>";

 

If anybody can help me I would be thankfull,

 

Rhiegen

 

PS: I've tried shell_exec even without any success. I'm using xampp 2.5, java jdk 1.6. I have tested my class in the same folder using java NsLookup ip_dns A domain_name and it was successfull.

 

 

Link to comment
https://forums.phpfreaks.com/topic/131034-calling-java-classes-using-php/
Share on other sites

for starters there is a whole library of network functions capable of doing DNS lookups http://nz.php.net/manual/en/ref.network.php

for your script to work it will be looking like

"java NSLookup Array("

because that is how PHP handles arrays

try it like this

$output = "dns_ip_number_here A www_domain_here";
$return = shell_exec("java NsLookup $output);
echo "<pre>The output was:\n$return\n\n";

 

Scott.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.