Skip to content

Instantly share code, notes, and snippets.

@IgorMiroshin
Last active November 7, 2019 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IgorMiroshin/3feaaee2d0e550fb4b86b67ca33dc46f to your computer and use it in GitHub Desktop.
Save IgorMiroshin/3feaaee2d0e550fb4b86b67ca33dc46f to your computer and use it in GitHub Desktop.
Sendmail in Telegram using curl request + SOCKS5 protocol
<?php
if (isset($_POST['phone']) && !empty($_POST['phone'])) {
$phone = strip_tags($_POST['phone']);
$phoneFieldset = "Phone: ";
}
if (isset($_POST['message']) && !empty($_POST['message'])) {
$message = strip_tags($_POST['message']);
$messageFieldset = "Message: ";
}
$token = "token";
$chat_id = "chat_id";
$arr = array(
$phoneFieldset => $phone,
$messageFieldset => $message
);
foreach ($arr as $key => $value) {
$txt .= "<b>" . $key . "</b> " . $value . "%0A";
};
$url = "https://api.telegram.org/bot{$token}/sendMessage?chat_id={$chat_id}&parse_mode=html&text={$txt}";
$proxy = "127.0.0.1:8080"; // ip:port, SOCKS5 servers http://spys.one/socks/
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
?>
@IgorMiroshin
Copy link
Author

IgorMiroshin commented Sep 12, 2019

Как получить token и chat_id для бота описано в данной статье:

https://smartlanding.biz/otpravka-dannyx-formy-v-telegram.html

How to get the token and chat_id for the bot described in this article:

https://smartlanding.biz/otpravka-dannyx-formy-v-telegram.html

@bismap
Copy link

bismap commented Nov 7, 2019

89114991090 Позвоните, есть работа для вас.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment