Android Question getting vars from html

rayellam

Member
Licensed User
Longtime User
Hi All,

Newbie question. On device #1 I am writing variables to an HTML page using HTTPServer and everything is good (HTML below)

<html>
<body>
B4X:
<html>
    <body>
        <!--<img style="width:200px;height:200px;"    src="android.png">-->
            <p><font size="7" face="Georgia, Arial" color="red">VariTrak</font></p>
        <p>
            Device Name: $DEVICENAME$<br/>   
        </p>
    </body>
</html>


On a second device I want to connect to the first via a WiFi network using it’s IP address (http://192.168.2.105:5555) and get the $DEVICENAME$ var from the html. Question is how do I connect and how do I retrieve the data?

Thanks
Ray
 

rayellam

Member
Licensed User
Longtime User
Hi Erel,
I try this..........data is a string containing the html code from #1 device

B4X:
  Dim p As JSONParser
  ToastMessageShow(data, False)
  p.Initialize(data) '(File.ReadString(File.DirAssets, "1.txt"))
  Dim list1 As List
  list1.Initialize
  list1 = p.NextArray <<<<<<<<<<<<<<<<<<<< error here
  Dim map1 As Map
  map1 = list1.Get(0)
  Log(map1)
  'Dim data As String
  data = map1.Get("$DEVICENAME$")
  ToastMessageShow(data, False)

Debug says list1 = p.NextArray............JSON array expected?

Think i need to chill for a while.........probably something real obvious but............

Ray
 
Upvote 0
Top