PHP - exec C++ with parameters -


i'm trying implement program recuperate picture , width of picture in order send process in c++ program. have no problem recuperate these items in php code. problem when send variables in php exec function. have tried lot of thing without results. thank in advance reply. herebelow, last code in php :

/* stock picture verify there no problem */ $image=$_request['image']; $binary=base64_decode($image); header('content-type: bitmap; charset=utf-8'); $file = fopen('test.jpg', 'wb');  fwrite($file, $binary);  fclose($file);   /* recuperate width of picture */ $width =$_request['width'];  $parameter = $binary;  //send parameter application exec("myapp.exe test {$parameter} {$width}"); 

it appears sending binary data command line, since part of png binary tag @ front of it, sent.

you want run

$parameter = "test.jpg"; exec("myapp.exe test {$parameter} {$width}"); 

or, want run:

$parameter = "test.jpg"; exec("myapp.exe test {$image} {$width}"); 

so passing base64 encoded data, rather raw binary.


Comments