Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.