Search code examples
phpandroidandroid-webview

how to run php Shell_exec script from website in android webview


I have a php web application deployed in iis. We then have developed a webview which we use to load the php web application inside the webview. on the php application we have a list of items and on click of one of them. it retrieves the file from the server into the tablet so that the file can be viewed using eDrawing app. Also im not sure if its possible to share files from the server into the tablet.

is it possible to run php shell_exec from php website in android webview. The website is loaded inside the webview. The reason i want to run it. is to open a file from the server using another application on tablet using intent.

something like below

$cmd ='#!/system/bin am start -a android.intent.action.VIEW -d http://www.stackoverflow.com';
shell_exec($cmd);

The script is inside the php web application that is deployed on iis. how possible can this be?


Solution

  • I have solved this. i ended up creating a virtual directory on iis under the application to map physical directory. In this way i can access the files using ip address port and the path which is the virtual directory.

    now i can use URLConnection and get the inputstream and share the file using Intent to targeted app on the tablet and open the file.