Re: [PHP] PHP to Java integration using : shell_exec function

2011-05-26 Thread Robert Williams
On 2011-05-26 12:00, "Eli Orr (Office)"  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 = 'hello';
$xml_shell = escapeshellarg($xml);

$result = shell_exec("/usr/bin/java/java -jar MyApp.jar -XML $xml_shell");

See: 

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).

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP to Java integration using : shell_exec function

2011-05-26 Thread Eli Orr (Office)


Hi,

Please advise if the following is possible and how can pass parameters 
from the PHP to the Java application.


Thanks.

Here's my script draft:

 // The XML_toEnc 
is a string and shall be urlencoded !
  $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?


echo  $EncXML; // back to the MObile Client

// Receiving client shall:
//  urldecode the string


?>


Eli Orr


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP to Java

2008-10-16 Thread Børge Holen


On Oct 16, 2008, at 10:50 PM, [EMAIL PROTECTED] wrote:



For reasons we needn't go into, I need to convert this to Java:

$to_encode = "example.com/api?foo=bar";
$key = "asdfasdfasdfasdfasdfasdf"; //fake value, but 24 bytes
$td = mcrypt_module_open('tripledes', '', 'ecb', '');
mcrypt_generic_init ($td, $key, $iv);
$c_t = mcrypt_generic ($td, $to_encode);

I've been Googling for hours and tried all kinds of stuff, none of  
which came even close.


Any suggestions on a good reference or conversion program or  
something?...


a little somethingsomething

String to_encode = new String("example.com/api?foo=bar");
String key = new String("asdfasdfasdfasdfasdfasdf");
Mcrypt_module td = new Mcrypt_module('tripledes', '', 'ecb', '');
td.init(key, iv);
td.mcrypt_generic(to_encode);





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





Re: [PHP] PHP to Java

2008-10-16 Thread Daniel Brown
On Thu, Oct 16, 2008 at 4:50 PM,  <[EMAIL PROTECTED]> wrote:
>
> Any suggestions on a good reference or conversion program or something?...

You could begin by not hiding behind the title of a CEO, Lynch.
We know it's you.  ;-P

-- 

More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP to Java

2008-10-16 Thread ceo

For reasons we needn't go into, I need to convert this to Java:



$to_encode = "example.com/api?foo=bar";

$key = "asdfasdfasdfasdfasdfasdf"; //fake value, but 24 bytes

$td = mcrypt_module_open('tripledes', '', 'ecb', '');

mcrypt_generic_init ($td, $key, $iv);

$c_t = mcrypt_generic ($td, $to_encode);



I've been Googling for hours and tried all kinds of stuff, none of which came 
even close.



Any suggestions on a good reference or conversion program or something?...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php