Re: PHP to Java integration using : shell_exec function

From: Date: Thu, 26 May 2011 19:34:02 +0000
Subject: Re: PHP to Java integration using : shell_exec function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-313157@lists.php.net to get a copy of this message
On 2011-05-26 12:00, "Eli Orr (Office)" <eli.orr@logodial.com> wrote: > $EncXML = shell_exec(""/usr/bin/java/java -jar MyApp.jar -XML ><$XML_toEnc>); <<== ??? How can I pass parameters like a large string of >let say XML? You're missing the shell escaping. Try something like this: $xml = '<greeting>hello</greeting>'; $xml_shell = escapeshellarg($xml); $result = shell_exec("/usr/bin/java/java -jar MyApp.jar -XML $xml_shell"); See: <http://us.php.net/manual/en/function.escapeshellarg.php> If you need to pass the value through standard input, you can pipe it out of echo: $result = shell_exec("/bin/echo -n $xml_shell | /usr/bin/java/java -jar MyApp.jar -XML"); Regards, Bob -- Robert E. Williams, Jr. Associate Vice President of Software Development Newtek Businesss Services, Inc. -- The Small Business Authority http://www.thesba.com/ Notice: This communication, including attachments, may contain information that is confidential. It constitutes non-public information intended to be conveyed only to the designated recipient(s). If the reader or recipient of this communication is not the intended recipient, an employee or agent of the intended recipient who is responsible for delivering it to the intended recipient, or if you believe that you have received this communication in error, please notify the sender immediately by return e-mail and promptly delete this e-mail, including attachments without reading or saving them in any manner. The unauthorized use, dissemination, distribution, or reproduction of this e-mail, including attachments, is prohibited and may be unlawful. If you have received this email in error, please notify us immediately by e-mail or telephone and delete the e-mail and the attachments (if any).

« previous php.general (#313157) next »