GrabWeb在MT4 Build 600上不工作 - 页 2 1234 新评论 [删除] 2014.02.06 09:17 #11 gchrmt4: ...然而,该脚本对于检索短的服务器响应,如许可查询的结果,应该仍然有效。只有当服务器的响应大小超过1KB左右时才会有问题。 谢谢你,这个工作非常好! [删除] 2014.02.07 17:55 #12 嗨,thili55。 你能帮助我们,把你让grabWeb()在Build 600中工作的解决方案贴出来吗?我想很多人都会对FFCal在Build 600下工作感兴趣。 非常感谢 gchrmt4 2014.02.07 18:00 #13 bennyHanna: 你能帮助我们,把你让grabWeb()在Build 600中工作的解决方案贴出来吗?我想很多人都会对FFCal能在Build 600下工作感兴趣。 请看thili55回复的帖子--但请注意,目前v600中似乎有字符串处理的问题,这可能会影响下载与FF日历一样多的数据。 [删除] 2014.02.07 18:18 #14 gchrmt4: 请看thili55回复的帖子--但请注意,目前v600中似乎有字符串处理的问题,可能会影响下载与FF日历一样多的数据。 谢谢你的回答。 所以我们需要等待v600的修复,然后再为grabWeb设计一个解决方案,对吗?还是在v603中提供了一个修复方案? Alain Verleyen 2014.02.07 20:33 #15 bennyHanna: 谢谢你的答复。 因此,我们需要等待v600的修复,然后再为grabWeb设计一个解决方案,对吗?还是在v603中提供了一个修复方案? 看来你不明白这个问题。代码必须被修复以考虑到mql4的变化。 [删除] 2014.02.08 16:00 #16 这是更新后的 GrabWeb 函数,可以在 v600 上运行。 它现在使用 InternetOpenW 和InternetOpenUrlW 以及 unicode 的转换。 它确实可以得到XML文件,但这些文件都有NULL数据。请看代码中StrWebPage的Print语句。 如果你看一下输出的数据,它是垃圾,而strThisRead有有效的数据。谁能看一下,看看是否能发现一个修复方法? 它是按照这个主题上的修复方法: https://www.mql5.com/en/forum/149360 只需在你的FFCal.mq4中复制并粘贴代码,用v600 MT4编译并运行(请编辑掉不属于你的版本的项目,以便编译)。 bool bWinInetDebug = false; #define READURL_BUFFER_SIZE 1000 #import "wininet.dll" int InternetOpenW(string, int, string, string, int); int InternetOpenUrlW(int, string, string, int, int, int); int InternetReadFile(int, uchar & arr[], int, int & arr[]); int InternetCloseHandle(int); #import //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // bool GrabWeb(string strUrl, string& strWebPage) { int hInternet; int hInternetUrl; bool bSuccess = false; // Get an internet handle hInternet = InternetOpenW("mt4", 0 /* 0 = INTERNET_OPEN_TYPE_PRECONFIG */, NULL, NULL, 0); if (bWinInetDebug) Log("hInternet: " + hInternet); if (hInternet == 0) { Message = Symbol() + " " + IndicatorName + " Error 890 - Unable to get an Internet Handle!"; Print(Message); Alert(Message); HealthBuffer[0] = Error_state; bSuccess = false; } else { // Get a URL handle hInternetUrl = InternetOpenUrlW(hInternet, NewsURL, NULL, 0, 0, 0); if (bWinInetDebug) Log("hInternetUrl: " + hInternetUrl); if (hInternetUrl == 0) { Message = Symbol() + " " + IndicatorName + " Error 891 - Unable to get a URL handle!"; Print(Message); Alert(Message); HealthBuffer[0] = Error_state; bSuccess = false; } else { Print("Reading URL: " + strUrl); bool bKeepReading = true; while (bKeepReading) { int lReturn[1]; uchar arrReceive[]; ArrayResize(arrReceive, READURL_BUFFER_SIZE + 1); int success = InternetReadFile(hInternetUrl, arrReceive, READURL_BUFFER_SIZE, lReturn); if (success == 0) { Message = Symbol() + " " + IndicatorName + " Error 892 - Unable to read News Database WebPage!"; Print(Message); Alert(Message); HealthBuffer[0] = Error_state; bKeepReading = false; bSuccess = false; } else { if (bWinInetDebug) Log("success: " + success); if (bWinInetDebug) Log("arrReceive: " + arrReceive[0]); if (bWinInetDebug) Log("lReturn: " + lReturn[0]); // InternetReadFile() has succeeded, but we may be at the end of the data if (lReturn[0] == 0) { if (bWinInetDebug) Print("Reached end of data"); bKeepReading = false; bSuccess = true; } else { // Convert the data from Ansi to Unicode using the built-in MT4 function string strThisRead = CharArrayToString(arrReceive, 0, lReturn[0], CP_UTF8); strWebPage = StringConcatenate(strWebPage, strThisRead); // <-- PROBLEM HERE ON FIRST USE ONLY IN EACH MT4 SESSION Print ("------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>> strWebPage : ", strWebPage); // this shows garbage! } } } } } Print("Closing URL web connection"); success = InternetCloseHandle(hInternetUrl); if (success == 0) { Message = Symbol() + " " + IndicatorName + " Error 896 - Unable to close URL handle!"; Print(Message); Alert(Message); HealthBuffer[0] = Error_state; bSuccess = false; } else { success = InternetCloseHandle(hInternet); if (success == 0) { Message = Symbol() + " " + IndicatorName + " Error 898 - Unable to close Internet Handle!"; Print(Message); Alert(Message); HealthBuffer[0] = Error_state; bSuccess = false; } } return(bSuccess); } // end of function Bambang Sugianto 2014.02.10 09:04 #17 我尝试制作一个GRABWEB脚本 非常简单......而且在604版中工作正常 #import "Wininet.dll" int InternetOpenW(string, int, string, string, int); int InternetConnectW(int, string, int, string, string, int, int, int); int HttpOpenRequestW(int, string, string, int, string, int, string, int); int InternetOpenUrlW(int, string, string, int, int, int); int InternetReadFile(int, string, int, int& OneInt[]); int InternetCloseHandle(int); #import int start() { string URL="http://www.forexfactory.com/ff_calendar_thisweek.xml"; int HttpOpen = InternetOpenW(" ", 0, " "," ",0 ); int HttpConnect = InternetConnectW(HttpOpen, "", 80, "", "", 3, 0, 1); int HttpRequest = InternetOpenUrlW(HttpOpen,URL, NULL, 0, 0, 0); int read[1]; string Buffer = " "; string NEWS = ""; while (true) { InternetReadFile(HttpRequest, Buffer, StringLen(Buffer), read); if (read[0] > 0) NEWS = NEWS + StringSubstr(Buffer, 0, read[0]); else break; } if (HttpRequest > 0) InternetCloseHandle(HttpRequest); if (HttpConnect > 0) InternetCloseHandle(HttpConnect); if (HttpOpen > 0) InternetCloseHandle(HttpOpen); MessageBox(NEWS, "HTTP READ:" ); // i show the result via message box //---- return(0); } //+------------------------------------------------------------------+ [删除] 2014.02.10 22:54 #18 WDholic:我尝试制作一个GRABWEB脚本非常简单......而且在Build 604中运行良好 我想知道你是如何克服这行代码在v604中的编译错误的。 InternetReadFile(HttpRequest, Buffer, StringLen(Buffer), read); 错误: 'Buffer' -参数 转换不允许 请检查您的MT4版本并再次尝试 Tjipke de Vries 2014.02.11 09:40 #19 bennyHanna: 我想知道你是如何克服这一行代码在v604中的编译错误的。 错误: 'Buffer' - 参数转换不允许 请检查您的MT4版本并再次尝试! 在我的V604和V600上没有这样的错误,用这个程序没有错误,也没有警告,文件被正确下载了。WDholic。 我尝试制作一个GRABWEB脚本 非常简单......而且在604版本中运行良好 我试过了,它对我来说也很有效....,谢谢你 Bambang Sugianto 2014.02.11 10:15 #20 bennyHanna: 我想知道你是如何克服这行代码在v604中的编译错误的。 错误: 'Buffer' - 参数转换不允许 请检查您的MT4版本并再试一次! 可能是你在使用u字符 int InternetReadFile(int, uchar & arr[], int, int & arr[]); 在我的脚本中,我使用了字符串 int InternetReadFile(int, string, int, int& OneInt[]); 1234 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
...然而,该脚本对于检索短的服务器响应,如许可查询的结果,应该仍然有效。只有当服务器的响应大小超过1KB左右时才会有问题。
谢谢你,这个工作非常好!
嗨,thili55。
你能帮助我们,把你让grabWeb()在Build 600中工作的解决方案贴出来吗?我想很多人都会对FFCal在Build 600下工作感兴趣。
非常感谢
你能帮助我们,把你让grabWeb()在Build 600中工作的解决方案贴出来吗?我想很多人都会对FFCal能在Build 600下工作感兴趣。
请看thili55回复的帖子--但请注意,目前v600中似乎有字符串处理的问题,可能会影响下载与FF日历一样多的数据。
谢谢你的回答。 所以我们需要等待v600的修复,然后再为grabWeb设计一个解决方案,对吗?还是在v603中提供了一个修复方案?
谢谢你的答复。 因此,我们需要等待v600的修复,然后再为grabWeb设计一个解决方案,对吗?还是在v603中提供了一个修复方案?
这是更新后的 GrabWeb 函数,可以在 v600 上运行。 它现在使用 InternetOpenW 和InternetOpenUrlW 以及 unicode 的转换。 它确实可以得到XML文件,但这些文件都有NULL数据。请看代码中StrWebPage的Print语句。 如果你看一下输出的数据,它是垃圾,而strThisRead有有效的数据。谁能看一下,看看是否能发现一个修复方法? 它是按照这个主题上的修复方法: https://www.mql5.com/en/forum/149360
只需在你的FFCal.mq4中复制并粘贴代码,用v600 MT4编译并运行(请编辑掉不属于你的版本的项目,以便编译)。
我尝试制作一个GRABWEB脚本
非常简单......而且在604版中工作正常
我尝试制作一个GRABWEB脚本
非常简单......而且在Build 604中运行良好
我想知道你是如何克服这行代码在v604中的编译错误的。
InternetReadFile(HttpRequest, Buffer, StringLen(Buffer), read);错误: 'Buffer' -参数 转换不允许
请检查您的MT4版本并再次尝试
我想知道你是如何克服这一行代码在v604中的编译错误的。
错误: 'Buffer' - 参数转换不允许
请检查您的MT4版本并再次尝试!
在我的V604和V600上没有这样的错误,用这个程序没有错误,也没有警告,文件被正确下载了。
我尝试制作一个GRABWEB脚本
非常简单......而且在604版本中运行良好
我想知道你是如何克服这行代码在v604中的编译错误的。
错误: 'Buffer' - 参数转换不允许
请检查您的MT4版本并再试一次!
可能是你在使用u字符
在我的脚本中,我使用了字符串