K
K
kornxolio2018-11-08 19:20:07
network hardware
kornxolio, 2018-11-08 19:20:07

Request to api.telegram.org?

Tell me how to fix the code for passing the request through a proxy for a request to the telegram bot, as you know, Roskomnadzor blocks these attempts.

#!/bin/sh

API_TOKEN=''
CHAT_ID=''

if [ -z "$CHAT_ID" ]; then
    echo 'Please, define CHAT_ID first! See "chat":{"id":xxxxxxx string below:'
    /usr/bin/wget -qO - https://api.telegram.org/bot$API_TOKEN/getUpdates
    exit 1
fi

MSG="<b>$(nvram get computer_name)</b>: [email protected]"

/usr/bin/wget -qs "https://api.telegram.org/bot$API_TOKEN/sendMessage?chat_id=$CHAT_ID&parse_mode=html&text=$MSG" 2>&1

if [ $? -eq 0 ]; then
    echo 'Message sent successfully.'
else
    echo 'Error while sending message!'
    exit 1
fi

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan Fedoseev, 2018-11-09
@martin74ua

man wget
/proxy
type sequentially

A
AlmazKayum, 2018-11-08
@AlmazKayum

Have you tried setting up a VPN on the server?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question