When accessing the page through the browser http://192.168.0.1/conninfo.php (this is a router), it issues

 var result = new Array("OK", "connected", "192.112.240.26", "255.255.255.255", "172.16.1.2", "194.28.28.3 8.8.8.8", ""); 

Tell me how to do it so that if it says "connected", for example, it will execute

 Label1.Caption:= 'трололо'; 

and the rest, where there are IP addresses, recorded in various Label, just do not care what action will take place, it is important for me to understand how to remove the information from the page and fulfill the condition, in this case I understand very little, so please explain in more detail, but rather ready script or example, I digress. Here is another found javascript on the page, mb will help somehow, I don’t browse it

 switch (result[0]) { case "OK": if (result[1] == "connected") { result[4] = result[2]; get_obj("connstate").value = "Подключен"; get_obj("wanipaddr").innerHTML = " " + result[2]; get_obj("wansubnet").innerHTML = " " + result[3]; get_obj("wangateway").innerHTML = " " + result[4]; get_obj("wandns").innerHTML = " " + result[5]; get_obj("bt_connect").disabled = false; } else { get_obj("connstate").value = "Отключен"; get_obj("wanipaddr").innerHTML = " 0.0.0.0"; get_obj("wansubnet").innerHTML = " 0.0.0.0"; get_obj("wangateway").innerHTML = " 0.0.0.0"; get_obj("wandns").innerHTML = " 194.28.28.3 8.8.8.8"; get_obj("bt_connect").disabled = false; } setTimeout("update_state()", period); break; case "WAIT": setTimeout("update_state()", period); break; } delete result; 
  • one
    This is a work for the author - Micha Nikolaev
  • one
    @hamik Clarify your question, it is incomprehensible. - Nicolas Chabanovsky
  • The php page when accessing it shows var result = new Array ("OK", "connected", "192.112.240.26", "255.255.255.255", "172.16.1.2", "194.28.28.3 8.8.8.8", "" ); judging by what was written, it is not difficult to guess that this is the connection state, how to make it so that when the “connected” status for me, for example, the window was closed, all IP addresses and DNS were recorded in separate Label - hamik
  • The case has moved forward a bit, now you need to write IP and DNS into separate fields, Memo, RichEdit or Edit no matter what - hamik


1 answer 1

using the functions pos (), copy (), delete (), parse (cut) data from the html code issued by the router

For example, to get connected from a given code you need to run

 if(pos("connected",{строка string с кодом выдаваемой страницы})>0 then {мы нашли коннектед} 
  • very fragile, it will break when the soap box gives up "disconnected" - karmadro4