I am developing a telegram bot that uses PHP to send data to the client. This is a telegram bot that allows the user to check if a domain name is already registered or not. If not registered it lets the user register it, if already registered it returns the whois information of the registered domain name.
This is partial part of my code:
if($inText) {
$domain = trim($inText);
if(substr(strtolower($domain), 0, 7) == "http://") $domain = substr($domain, 7);
if(substr(strtolower($domain), 0, 4) == "www.") $domain = substr($domain, 4);
if(ValidateIP($domain)) {
$caption = LookupIP($domain);
}
elseif(ValidateDomain($domain)) {
$caption = LookupDomain($domain);
//$errorchars = array('no match','No results','NOT FOUND');
//strtolower($errorchars)
if(strpos(strtolower($caption),'no match') !== false or strpos(strtolower($caption),'no results') !== false or strpos(strtolower($caption),'not found') !== false){
$caption = "
Domain $domain is available to register
You can register it here :
http://something.com/?register=$domain
static text
static text
☎️ static text
";}
else{
$caption = "
Dear user,
the domain $domain is already registered!
Domain Whois info:
$caption
The Domain name is already registered
static text
static text
☎️ static text
";
}
}
else $caption = "Entry is invalid";
}
$photo = "https://kmc.im/glassbot/1.jpg";
//$caption = LookupDomain ($inText);
$output1 = "
static text
static text
☎️ static text
";
$sendP = sendPhoto($cid, $photo, $botapi ,$output1,$encodedMarkup) ;
$sendP1 = sendMessage($cid, $caption, $botapi ,$encodedMarkup) ;
$sendP2 = sendMessage($adminID, "$caption \n ID : $cid \n User : @$uname", $botapi ,$encodedMarkup) ;
}
?>
The code works prefectly and it does the job right.
Where it says:
Domain Whois info:
$caption
is when a domain name is already registered, $caption returns the whois information.
What I want to do is the add a function that saves the value of $caption into a text file. So I can keep a record of it.
I have been struggling with it for a while and couldn't get it right.
Your help is appreciated.
Thank you