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

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.

sir pls help me . pls tell me how to do it

Load the web page to your webviewer, then after page loaded, run the javascript and return value to a label (do what you want with the value)

This example returns all the html of the rendered page

1 Like

Thank You