35 lines
No EOL
3.1 KiB
MQL5
35 lines
No EOL
3.1 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| Requests test.mq5 |
|
|
//| Copyright 2023, Omegafx |
|
|
//| https://www.mql5.com/en/users/omegajoctan/seller |
|
|
//+------------------------------------------------------------------+
|
|
#property copyright "Copyright 2023, Omegafx"
|
|
#property link "https://www.mql5.com/en/users/omegajoctan/seller"
|
|
#property version "1.00"
|
|
|
|
#include <requests.mqh>
|
|
//+------------------------------------------------------------------+
|
|
//| Script program start function |
|
|
//+------------------------------------------------------------------+
|
|
void OnStart()
|
|
{
|
|
//---
|
|
string keys[] = {"user", "id", "lang"};
|
|
string values[] = {"omega", "123", "mql5 test"};
|
|
|
|
string parent_url = "https://httpbin.org/get";
|
|
string final_url = CSession::BuildUrlWithParams(parent_url, keys, values); //builds a URL with the given parameters
|
|
|
|
Print("final url: ",final_url);
|
|
|
|
//---
|
|
|
|
CResponse response = CSession::get(final_url); //Get the headers from the server
|
|
|
|
Print("HTTP response");
|
|
Print("--> Headers:\n", response.headers);
|
|
Print("--> Response text: ",response.text);
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+ |