WebRequest函数:发送 HTTP 请求到指定服务器。
1、发送简单请求,使用内容-类型标题的"key=value"类型:application/x-www-form-urlencoded;
2. 发送任何类型的请求,为了各种网络服务的更灵活互动指定自定义的标题设置。
案例1
#property copyright "佚名金人"
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
string url = "http://127.0.0.1:5000";
string cookie = "";
string referer = "";
int timeout = 3000;
char data[];
int data_size = 0;
char result[];
string result_headers;
int res = WebRequest("GET", url, cookie, referer, timeout, data, data_size, result, result_headers);
Alert("res=>" + res);
Alert("result=>" + CharArrayToString(result));
//
}
//+------------------------------------------------------------------+
测试说明:
留言与评论(共有 0 条评论) “” |