1

Possible Duplicate:
Execute external program from Java

Is it possible to Run a php script from a java class. My project is a struts2 frame work web application. Its purely a java webapp We use a php script to run some daily cron jobs. It was written in php by an ex-employee. Is there a way to run the php script from the javaclass?

0

1 Answer 1

1

Since you're essentially running a command line script, you could use Runtime.getRuntime().exec. Here's a page with a plethora of examples: http://www.rgagnon.com/javadetails/java-0014.html.

If the PHP script is externalized as a web page, you could use Java's URLConnection to call the page so it runs. Documentation: http://download.oracle.com/javase/tutorial/networking/urls/readingWriting.html

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.