user4401819
user4401819

Reputation:

How can I check if a URL has a valid public TLD?

So I'm going to get a URL from a form and I want to make sure that only ones that have a valid public tld in them are accepted (so that http://google.com is accepted, but not http://google.notatld). How would I do this?

Upvotes: 2

Views: 441

Answers (1)

Rahul Agrawal
Rahul Agrawal

Reputation: 127

You can use tldextract Library. Check the link here.

Upvotes: 1

Related Questions