IvanIvanov: Does anyone have any examples of how to use this function because the manual is silent on this topic!
How is it silent, it's all explained there.
There are examples of WinInet in the bezet code, and there are also working, tested examples.
voidOnStart()
{
string cookie=NULL,headers;
char post[],result[];
int res;
//--- для работы с сервером необходимо добавить URL "https://www.google.com/finance" //--- в список разрешенных URL (Главное меню->Сервис->Настройки, вкладка "Советники"):string google_url="https://www.google.com/finance";
//--- обнуляем код последней ошибкиResetLastError();
//--- загрузка html-страницы с Google Finance
res=WebRequest("GET",google_url,cookie,NULL,50,post,0,result,headers);
//--- проверка ошибокif(res==-1)
{
Print("Ошибка в WebRequest. Код ошибки =",GetLastError());
//--- возможно URL отсутствует в списке, выводим сообщение о необходимости его добавленияMessageBox("Необходимо добавить адрес '"+google_url+"' в список разрешенных URL во вкладке 'Советники'","Ошибка",MB_ICONINFORMATION);
}
else
{
//--- успешная загрузкаPrintFormat("Файл успешно загружен, Размер файла =%d байт.",ArraySize(result));
//--- сохраняем данные в файлint filehandle=FileOpen("GoogleFinance.htm",FILE_WRITE|FILE_BIN);
//--- проверка ошибкиif(filehandle!=INVALID_HANDLE)
{
//--- сохраняем содержимое массива result[] в файлFileWriteArray(filehandle,result,0,ArraySize(result));
//--- закрываем файлFileClose(filehandle);
}
elsePrint("Ошибка в FileOpen. Код ошибки =",GetLastError());
}
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Does anyone have any examples of how to use this function because the manual is silent on this topic!
How is it silent, it's all explained there.
There are examples of WinInet in the bezet code, and there are also working, tested examples.
how it's silent, it's all written down.
Well, not all of it. Renat said
Is there an example of POST request written in help? Or file download?
Well, not all of them. Renat said
Is there an example of POST request in help? Or file download?
It says GET, so it means GET-request, if POST, then POST-request (with POST-request more request parameters can be sent).
In the variable result is written what is on the link:
https://www.google.com/financeThen the result is written to a file and the file is opened for writing as a binary file.
ZS: search the code base for WinInet examples, it's the same here.
If it says GET, then GET-request, if POST, then POST-request (with POST-request also request parameters can be sent).
into the variable result is written what is via link:
further the result is written to the file, the file is opened for writing as binary.
Well this I understand, the help is not an example.
Next, I am interested in loading non-text data by POST-request.
Traceroute requests, always passed in the header
Although to download the image seems to need
I used to do it like this, but it's not right and it's not made to fit the picture:
No, you can do anything with a DLL.
Thanks for the example.
I'm interested in the regular tools, WebRequest.
No, you can do anything with a DLL.
I'm interested in the regular tools, WebRequest.
do the same as with WinInet, I understand that you just have a problem with the header being correct.