i made jar file (stringgenerator.jar) gets command line parameter, generates string based on parameter , prints string on standard output. this:
stringgenerator.java
public class stringgenerator { public static void main(string[] args) { string s = args[0]; // ... modifies s ... system.out.println(s); } }
now need php code executes stringgenerator.jar, gets value of s , redirects user.
i'm trying this:
index.php
<?php exec('java -jar stringgenerator.jar $parameter', $output); header("location: /someurl/$output[0]"); ?>
but $output empty array (and therefore user redirected "/someurl/" ). how can work?
thank you.
try approach:
<?php exec('java -jar stringgenerator.jar $parameter 2>&1', $output); header("location: /someurl/$output[0]"); ?>
2>&1
ensures output goes php handler.
Comments
Post a Comment