Script or API to check if domain is available in PHP

Asked

Viewed 543 times

0

Do you guys know any opensource scripts or Apis that are running in PHP to see if a domain is available? One that works for extensions .com.br, I looked for some but so far nothing functional, if you have for Codeigniter would be great

  • Good morning Carlos, just let me know have you tried Whoapi.com? https://whoapi.com/documentation/code_examples

1 answer

2

You don’t necessarily need an API. A simple file_get_contents( ) can solve your problem.

Example 1: the domain test555.com.br is registered?

$content = file_get_contents('https://www.whois.com/whois/teste555.com.br');

Not. Why? Why was the string found "No match for teste5555.com.br" in $content, the variable that received the return.


Example 2: the google.com domain is registered?

$content = file_get_contents('https://www.whois.com/whois/google.com');

Yes, because it was not found "No match for google.com" in $content. And with echo($content); you can still see all the domain information. Whois works for all country extensions, I think, since I’ve always found what I need.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.