PHPを使用してクライアントにデータを送信する電報ロボットを開発しています。 ドメイン名がすでに登録されているかどうかを確認するための電信ボットです。登録されていない場合、ユーザーはそれを登録できます。すでに登録されている場合は、登録されたドメイン名のwhois情報を返します。PHPがtxtファイルにデータを送信/保存する
これは私のコードの部分的な一部です:
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) ;
}
?>
コードがprefectly動作し、それが仕事が右ありません。それが言う
:
Domain Whois info:
$caption
は、ドメイン名が既に登録されている場合、$のキャプションは、WHOIS情報を返すです。
私がしたいことは、$ captionの値をテキストファイルに保存する関数を追加することです。だから私はそれを記録することができます。
私はしばらくそれに苦しんでおり、それを正しくすることができませんでした。
あなたのお手伝いがありがとうございます。
あなたは
'file_put_contents()'? http://php.net/manual/en/function.file-put-contents.php – JustBaron