!7

p {
  S ip = gateway();
  S url = "http://" + ip + ":7777";
  S html = loadPage(url);
  
  if (containsIC(html, "Phone server"))
    print("Phone server running (no password)");
  else if (match("No", html)) {
    print("Phone server running, but password-protected");
    S pw = loadSecretTextFile("phone-server-password");
    if (empty(pw)) print("I have no password for the server.");
    else {
      print("Trying password.");
      S html = loadPage(url + "/" + htmlQuery(password := pw));
      if (containsIC(html, "Phone server"))
        print("SUCCESS: Phone server running & I have the password!");
      else if (match("No", html))
        print("Phone server running, but I ain't got the password.");
      else
        print("No idea what's up: " + html);
    }
  }
}