I need to create a function that returns if a URL is reachable or valid.
I am currently using something like the following to determine a valid url:
You'll likely be limited to sending some kind of HTTP request. Then you can check HTTP status codes.
Be sure to send only a "HEAD" request, which doesn't pull back all the content. That ought to be sufficient and lightweight enough.