我是编程新手。我需要编写一个代码,用MQL4语言获取网页。我复制/粘贴了 WebRequest()
代码:
res = WebRequest( "GET",
Inv_url,
cookie,
NULL,
timeout,
post,
0,
result,
headers
);
可以下载整页。
然而我想只获得一个页面表,就像我在Excel中创建新查询一样。
感谢您的帮助。
答案 0 :(得分:-1)
MQL4
started it's life as a language for an ultra-fast / near-real-time oriented code-execution platform ( a.k.a. [ MetaTrader Terminal 4 ] ).
This said, the language can handle very smart & fast register shifting, not to lose any amount of time inside the Market-event triggered data-stream-processing, cadence of which is many events inside a single millisecond, yes, many inside a single millisecond ( sometimes high number of hundreds of 'em in prime time ).
With this in focus, it comes natural, that there is literally no direct language / syntax support for any common markup-language-wrapped-{http|script}
-composition and/or interaction with that.
For the first decade of it's life-cycle, the originally solid MQL4
language ( not the recent year or two ( still a lot creeping ) New-MQL4.56789
derivative attempt to move and enforce the MQL4
-domain towards the MQL5
-domain, but it is another topic, sure ), had no support for any kind of interactions "outside of the MT4-box". Simply nothing, to avoid any sort of disturbances from external non-core, potentially blocking processes, that could de-stabilise the tough real-time execution loop of the platform.
As a fast proxy solution, one may forget about MQL4
-syntax ( functions et al ) and start thinking about doing the MQL4
-part as usual and extend the [ MetaTrader Terminal 4 ] processes so as to become able to communicate with external ( distributed ) hosts, where ( as the easiest prototyping example ) a python
process can do the job, that would otherwise be hard for MQL4
.
This is exactly the approach, where one does not risk MQL4
troubles with parsing the markup-language-wrapped-{http|script}
-composition to find any element(s) one needs.
This builds on python
strengths in doing this very part and leaves one in just orchestrating the mutual-cooperation of such distributed-process workflow.
After many hundred man*years of experimenting and code-base maintenance, my choice No.1 is [ZeroMQ]
or [nanomsg]
.
When not willing to invest one's own "blood, tears & sweat" into these or other smart distributed signalling / communications architectures, one may use as a last resort going into MQL4 WebRequest()
even for integration against python-based lightweight-webServer to complete the intended processing-flow and deliver the wanted results onto MQL4-side.