文章 "如何采用 MQL5 创建用于 Telegram 的 bots" - 页 29

 
Andrey Voytenko:

我问每个有错误 1001 的人。

请运行此脚本,并将专家选项卡中的结果行粘贴到这里。

举例说明:

2020.06.05 18:06:36.033 WebRequest_Test_Script (EURUSD,H4) Build=2470 WebRequest=1001 GetLastError=5203 strData=

补充描述您的操作系统

Windows 7 7601 SP1

这将有助于解决这一问题。

首先,感谢 Andrey 的回复。

这是我的名为 "t0.mql5 "的脚本的输出结果:

2020.06.07 09:27:29.537 t0 (EURUSD,H1)  Build=2475 WebRequest=1001 GetLastError=5203 strData=


  • 操作系统:
Windows 10 Pro 64 bit
命令行 "ver "命令返回:Microsoft Windows [Version 10.0.18362.778]
  • Metatrader 5,第 2475 版
  • "GetLastError=5203"表示HTTP 请求失败:我没有安装防火墙软件(我只有一个免费版的 bitdefender Antivirus,从来没有出过问题)。
  • 我重新检查了这些东西:1)BotFather 中的令牌,2)Tools\Options\"Allowweb request"(允许网络请求)和相关地址。3)我还使用了 "VPN "服务来检查,但没有任何变化。4)关闭 Windows 防火墙。
Documentation on MQL5: Network Functions / WebRequest
Documentation on MQL5: Network Functions / WebRequest
  • www.mql5.com
To use the WebRequest() function, add the addresses of the required servers in the list of allowed URLs in the "Expert Advisors" tab of the "Options" window. Server port is automatically selected on the basis of the specified protocol - 80 for "http://" and 443 for "https://". The WebRequest() function is synchronous, which means its breaks the...
 

@aboozar sobboohi 请在命令提示符下运行此请求,并将结果粘贴到这里。如果您没有 cURL,请从这里安装https://curl.haxx.se/windows/

curl -X POST https://api.telegram.org/bot177791741:AAEcSxsNEu8625Y2I4KAw_H7yGev9tl8uJg/getMe

aboozar sobboohi
aboozar sobboohi
  • www.mql5.com
Trader's profile
 
Andrey Voytenko:

@aboozar sobboohi 请在命令提示符下运行此请求,并将结果粘贴到这里。如果您没有 cURL,请从这里安装 https://curl.haxx.se/windows/

curl -X POST https://api.telegram.org/bot177791741:AAEcSxsNEu8625Y2I4KAw_H7yGev9tl8uJg/getMe

我不习惯使用 curl。它没有 "Setup.exe"。我只是解压缩后用你的和我自己的令牌运行了一下!

C:\t_SM\Telegram_mql5\curl-7.70.0_1-win64-mingw\curl-7.70.0-win64-mingw\bin>curl -X POST https://api.telegram.org/bot177791741:AAEcSxsNEu8625Y2I4KAw_H7yGev9tl8uJg/getMe
curl: (7) Failed to connect to api.telegram.org port 443: Connection refused

C:\t_SM\Telegram_mql5\curl-7.70.0_1-win64-mingw\curl-7.70.0-win64-mingw\bin>curl -X POST https://api.telegram.org/bot996256588:AAH2yUhFSjexpOUxxj2ZLOmRQXXItAF-B_4/getMe
curl: (7) Failed to connect to api.telegram.org port 443: Connection refused

已解决 "Error:未知错误 1001" =======> 我的 ISP 问题

现在我从 cURL 和 Webrequest 测试仪中得到了这个输出结果:

C:\t_SM\Telegram_mql5\curl-7.70.0_1-win64-mingw\curl-7.70.0-win64-mingw\bin>curl -X POST https://api.telegram.org/bot996256588:AAH2yUhFSjexpOUxxj2ZLOmRQXXItAF-B_4/getMe
{"ok":true,"result":{"id":996256588,"is_bot":true,"first_name":"Signal1","username":"Signal1bot","can_join_groups":true,"can_read_all_group_messages":false,"supports_inline_queries":false}}

"WebRequest_Test_Script.mq5" exexcution result on 'Experts' Tab of Toolbox:
2020.06.07 11:32:23.084 t0 (EURUSD,H1)  Build=2485 WebRequest=200 GetLastError=0 strData={"ok":true,"result":{"id":996256588,"is_bot":true,"first_name":"Signal1","username":"Signal1bot","can_join_groups":true,"can_read_all_group_messages":false,"supports_inline_queries":false}}

Andrey 你帮我找到了它。

 
Andrey Voytenko:

我问每个有错误 1001 的人。

请运行此脚本,并将专家选项卡中的结果行粘贴到这里。

举例说明:

2020.06.05 18:06:36.033 WebRequest_Test_Script (EURUSD,H4) Build=2470 WebRequest=1001 GetLastError=5203 strData=

补充描述您的操作系统

Windows 7 7601 SP1

这将有助于解决这一问题。

我已经在两个系统中测试了你的脚本

第一个系统是 windows 7 7601 SP1,运行时出现了类似你的错误
第二个系统是 windows 10 pro 64 bit build 18363,运行良好没有错误


 

@GedThey MaThey

请在 Windows 7 7601 SP1 上用命令提示符运行此请求,并将结果粘贴到这里。如果您没有 cURL,请从这里安装https://curl.haxx.se/windows/

curl -X POST https://api.telegram.org/bot177791741:AAEcSxsNEu8625Y2I4KAw_H7yGev9tl8uJg/getMe

curl for Windows
  • curl.haxx.se
These are the latest and most up to date official curl binary builds for Microsoft Windows. curl version : 7.70.0 Build : 7.70.0_1 Date : 2020-04-29 Changes : 7.70.0 changelog Packages curl for 64 bit Size: 3.2 MB sha256: c9ea2abc80b78e65f9eebe155272c7f27a80a264fe926a398aa5b48d4f5b4e0e curl for 32 bit Size: 3.0 MB sha256...
 
Andrey Voytenko:

@GedThey MaThey

请在 Windows 7 7601 SP1 上用命令提示符运行此请求,并将结果粘贴到这里。如果您没有 cURL,请从这里安装https://curl.haxx.se/windows/

curl -X POST https://api.telegram.org/bot177791741:AAEcSxsNEu8625Y2I4KAw_H7yGev9tl8uJg/getMe

我有来自 Windows 7 的结果

附加的文件:
 
GedThey MaThey:

我有来自 Windows 7 的结果

测试结果 很有用。谢谢。

 
Andrey Voytenko:

测试结果 很有用。谢谢。

欢迎先生

 
Andrey Voytenko:

我问每个有错误 1001 的人。

请运行此脚本,并将专家选项卡中的结果行粘贴到这里。

举例说明:

2020.06.05 18:06:36.033 WebRequest_Test_Script (EURUSD,H4) Build=2470 WebRequest=1001 GetLastError=5203 strData=

补充描述您的操作系统

Windows 7 7601 SP1

这将有助于解决这一问题。

额外测试,我在 Windows 7 7601 sp1 中的 mt4 上进行了测试,错误相同

附加的文件:
 

@Rashid Umarov 又一次测试的结果。