Script or API to check if domain is available in PHP

0

Do you guys know any script or API that is open source that is running in PHP to see if a domain is available? One that works for extensions .com.br, I searched for some but so far nothing functional, if I have for CodeIgniter would be great

    
asked by anonymous 13.02.2017 / 02:08

1 answer

2

You do not necessarily need an API. A simple file_get_contents( ) can solve your problem.

Example 1: Is the domain test555.com registered?

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

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


Example 2: Is the domain google.com registered?

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

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

    
11.07.2017 / 17:13