Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php // Get the visitor's IP address $ip = $_SERVER['REMOTE_ADDR']; // Get the visit..

Decoded Output download

<?php 
// Get the visitor's IP address 
$ip = $_SERVER['REMOTE_ADDR']; 
 
// Get the visitor's device information 
$device = $_SERVER['HTTP_USER_AGENT']; 
 
// Use an API to get the visitor's city and approximate location based on the IP address 
// You can use any API that provides this service, such as ipinfo.io or ip-api.com 
// For this example, we will use ipinfo.io 
$api_key = "your_api_key"; // Replace this with your own API key 
$url = "https://ipinfo.io/$ip?token=$api_key"; 
$response = file_get_contents($url); 
$data = json_decode($response, true); 
$city = $data['city']; 
$location = $data['loc']; 
 
// Get the current date and time 
$date = date('Y-m-d'); 
$time = date('H:i:s'); 
 
// Create a message with the visitor's information 
$message = "Visitor IP: $ip
"; 
$message .= "Visitor device: $device
"; 
$message .= "Visitor city: $city
"; 
$message .= "Visitor location: $location
"; 
$message .= "Visit date: $date
"; 
$message .= "Visit time: $time
"; 
 
// Send the message to your Telegram bot using the Telegram API 
// You need to create a Telegram bot using the BotFather bot and get the chat ID of the group or channel where you want to send notifications 
// You can find the instructions on how to do this [here](https://stackoverflow.com/questions/48290075/send-a-message-to-a-telegram-bot-using-php) and [here](https://stackoverflow.com/questions/71147346/send-message-telegram-using-php) 
$bot_token = "your_bot_token"; // Replace this with your own bot token 
$chat_id = "your_chat_id"; // Replace this with your own chat ID 
$telegram_url = "https://api.telegram.org/bot$bot_token/sendMessage?chat_id=$chat_id&text=$message"; 
$telegram_response = file_get_contents($telegram_url); 
 
// You can check the response from the Telegram API for any errors or success messages 
// For example, you can echo the response or write it to a log file 
echo $telegram_response; 
?>

Did this file decode correctly?

Original Code

<?php
// Get the visitor's IP address
$ip = $_SERVER['REMOTE_ADDR'];

// Get the visitor's device information
$device = $_SERVER['HTTP_USER_AGENT'];

// Use an API to get the visitor's city and approximate location based on the IP address
// You can use any API that provides this service, such as ipinfo.io or ip-api.com
// For this example, we will use ipinfo.io
$api_key = "your_api_key"; // Replace this with your own API key
$url = "https://ipinfo.io/$ip?token=$api_key";
$response = file_get_contents($url);
$data = json_decode($response, true);
$city = $data['city'];
$location = $data['loc'];

// Get the current date and time
$date = date('Y-m-d');
$time = date('H:i:s');

// Create a message with the visitor's information
$message = "Visitor IP: $ip\n";
$message .= "Visitor device: $device\n";
$message .= "Visitor city: $city\n";
$message .= "Visitor location: $location\n";
$message .= "Visit date: $date\n";
$message .= "Visit time: $time\n";

// Send the message to your Telegram bot using the Telegram API
// You need to create a Telegram bot using the BotFather bot and get the chat ID of the group or channel where you want to send notifications
// You can find the instructions on how to do this [here](https://stackoverflow.com/questions/48290075/send-a-message-to-a-telegram-bot-using-php) and [here](https://stackoverflow.com/questions/71147346/send-message-telegram-using-php)
$bot_token = "your_bot_token"; // Replace this with your own bot token
$chat_id = "your_chat_id"; // Replace this with your own chat ID
$telegram_url = "https://api.telegram.org/bot$bot_token/sendMessage?chat_id=$chat_id&text=$message";
$telegram_response = file_get_contents($telegram_url);

// You can check the response from the Telegram API for any errors or success messages
// For example, you can echo the response or write it to a log file
echo $telegram_response;
?>

Function Calls

json_decode 1
file_get_contents 1

Variables

$ip None
$url https://ipinfo.io/None?token=your_api_key
$device None
$api_key your_api_key
$response

Stats

MD5 12c4274c7b625db7df3cbdfa11b19eaa
Eval Count 0
Decode Time 53 ms