Is web site available from within a scene

I have been searching the Q&A to get an answer but everything I look it either costs money (which, being out of work I currently don’t have) or doesn’t work in all situations (i.e. public vs private).

What I’m trying to accomplish is to see if a single domain can be reached within Unity by means of a single function.

I simply need a boolean returned but I’m finding it hard to determine which function (if there is one) I can use.

I know you can use “Ping” but this can return true if a public hot spot is available, even if you don’t have actual “access” to it.

What I’m looking for is something like…

public bool webSiteReachable(string webSite) {
    TestConnection result = new TestConnection(webSite);
    return(result.isAccessible);
}

What I’d like to know is, what function can I use as “TestConnection”?

I hope I’ve explained myself clearly enough and any help, as always, is greatly appreciated.

What you’re searching is probably WWW ( Unity - Scripting API: WWW )

And you could do:

    bool isRecheable = false;

    public IEnumerator webSiteReachable(string webSite) 
   {
      WWW www = new WWW(url);
        yield return www;
      if (String.IsNullOrEmpty(www.error)) 
      {
         isRecheable = true;
      }
      else
      {
          isRecheable = false;
      }

   }

But as you can see your function will have to be IEnumerator type so you’ll have to make a global bool OR make a callback at the end of the function.