java & php together
| From: | cmkpl | Date: | Wed, 14 May 2003 07:33:08 +0000 |
| Subject: | java & php together | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-19926@lists.php.net to get a copy of this message | ||
import java.io.*;
class WebServer{
public static void main(String[] a) throws Exception {
String s= null;
Process t = Runtime.getRuntime().exec("C:/php/php.exe");
//Use a writer to send commands to your program
PrintWriter out = new PrintWriter(t.getOutputStream());
out.println("<?php header(\"aa\");print \"aaa\n\n\n\"$a=1;print
\"$a\"?>\n\nasf");
out.close();
int x = t.waitFor();
BufferedReader in = new BufferedReader(new
InputStreamReader(t.getInputStream()));
while ((s=in.readLine()) != null)
{
System.out.println(s);
}
}
}
only cli/php.exe can but php.exe can't,why?
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.478 / Virus Database: 275 - Release Date: 6/5/2003