If you want to keep the webpage more or less the same, allowing access from a browser, and not have a separate JSON or other file, you could use extended attributes in the web page, which could be easily parsed by using a pattern match in B4A. For instance, if the current web page contains something like
You could probably fairly easily change that to include some extra tags, using the more or less standard data-xxx way of defining an attribute, so you have something like this in the code:
<p id="port1" data-port1-status="on">Port 1: on</p>
Then, your B4A code looks for the string "data-port-1-status=" in the code of the web page, and checks for the value. People looking at the output of the arduino in a web browser will see no difference to the page at all.