How do you get the text from a returned web page through either Web or WebViewer components?

I am totally stuck!

I want to send a get request to an Arduino and read its response in my Android App.

However if I use the 'Web1.set web1 URL' block with the 'web1.GotText' event then my app throws the '1011 no response error.

If I use the 'WebViewer1,GoToURL' block with the 'WebViewer1.PageLoaded' event then I get the correct response from my Arduino but there does not seem to be any way to get the text from WebViewer.

There has got to be a way to do this!

image

Please give the URL

My Arduino is setup as an Access Point. The URL is 192.168.0.10/TANK~

I am simply using the TANK~ bit as a back door UDP message.

Since apparently, at the Arduino end, it is impossible to receive both http and udp requests within the Arduino sketch due to limitations of the Arduino library or in the ESP8266 firmware I have loaded on the ESP8266.

Oh sorry, I don't know much about Adruino. May some other person help you

The Arduino stuff is irrelevant.
As far as my app is concerned it is simply getting a web page with the text "OK"
I just want to know how I can get access to that text to test if it is equal to "OK" or not.
And I can't find a way within the MIT app inventors blocks to do that at present.
There has got to be a way of doing this

I tried that and it doesn't work.

As far as my app is concerned it does not get a response and throws the 1011 error.

In the code of your image there is no GET block.

That was the first thing I tried and all I got was error 1011.

I will try WebViewer1 and Web1 together and see if it makes a difference.

I just tried this on an ESP32 and it worked for me:

Well I can't get Web1 to work - it just keeps throwing error 1011.

WebViewer1 works with that URL but then there is no way for me to access the text in the response.

Bloody irritating I have to say!
image

If you wish to use WebViewer then you can get plain text using below js code:

document.body.innerText

Or

document.getElementsByTagName("body")[0].innerText

OK - will give it a try. Thanks.

But what is the point of Web1 if you can't link to any web pages?

What is it doing? Checking for web access on your phone and then crapping out rather than trying the specified IP address?

Web component is only to send requests to a server (and output the string value if there is any) while WebViewer is able to show the result.

The web component will send a request to a web page and return the result from the request, if that web page outputs a result.

Output the string value where and how? And what is the 1011 error about?

I assume like this?
But then how do I access the output from "
document.body.innerText"
image

Ooops my bad...You should try this instead:

If you are submitting a web page, try adding a header to it, for example:

client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println(""); // Important.

Thanks pal - that worked.