Reputation: 33
I am wondering if it is possible to pull the innerHTML of a web page once it is loaded via ADB command line only.
I want to check my public IP address of my android device to verify the Proxy is active before running additional commands/services. I plan to validate the known Proxy using https://api.ipify.org
I can run the following command:
adb shell am start -a android.intent.action.VIEW -d https://api.ipify.org
Only problem is i have no way of grabbing the result and relaying it back via command line. I also want to avoid opening a web page on the device and have this query be done in the background.
Just to add that I am rooted which may help with the solution.
I have done a lot of research and came across this tool: https://www.cyberciti.biz/faq/unix-linux-get-the-contents-of-a-webpage-in-a-terminal but have no idea how to get this to work or even if this is the way to go.
I know how to do this using VB with the post method using a WinHttp request, but when it comes to android/linux I am completely lost!
Thanks in advance
Kind regards, Maddis :)
Upvotes: 1
Views: 769
Reputation: 42615
Using am start
to execute something you want to get the response of is a bad idea because am start
works asynchronously and thus can not give you any direct response.
As it is your phone only I recommend to install a a Linux command-line tool like curl
or wget
to /data/local/tmp
or /data/local
depending on your Android version. A simple wget
version is usually included in busybox so there should be a number of precompiled binaries available you can simply push to thed evice, copy to /data/local/tmp
or /data/local
, make it executable via chmod
and then use to request your public IP using the mentioned API.
Upvotes: 1