Reputation: 199
Would there be anyway to merge the below queries into a single function? As it stands only the second Strpos function works. If i remove the second one then the first one will work. I need to run both as I have to check for 2 separate strings.
$check1 = QueryWhoisServer($whoisserver, $domain);
if(strpos($check1,"No match for") !== FALSE){
return "Result Example";
}
$check2 = QueryWhoisServer($whoisserver, $domain);
if(strpos($check2,"No Data Found") !== FALSE){
return "Result 2 example";
}
else {
Any help would be much appreciated.
Upvotes: 2
Views: 325
Reputation: 173562
First of all, you should keep the output of your whois query.
$response = QueryWhoisServer($whoisserver, $domain);
Then, you can run multiple searches:
if (false !== strpos($response, 'No match for')) {
// ...
} elseif (false !== strpos($response, 'No Data Found')) {
// ...
} else {
// ...
}
Upvotes: 1