似乎有些资源很旧。 检查域可用性。 PHP

Here is what I currently have to get the list of domains.

<?php
$myFile = "domains.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 500);
fclose($fh);
echo nl2br($theData);
?>

This fetches the file and lists the domains in an order like:

Domain.com

Domain2.com

Domain3.com

I want to assign a function for each domain in the list to be ran through a whois query and if available post domain.com - available (later down the road I will have it run a API query to register) and if not available post domain.com - taken

Any idea where to get started?

Well, reading a file with one domain per line into an array of domains is a one-liner.

$domains = file('domains.txt');
foreach ($domains as $domain) {
  //run the whois query on $domain
}