404 Error:
Missing Document
The server could not locate the document you requested.
you may use wininet.dll to download files from website to local file and then read i from EA
do you have any reference using wininet.dll ?
this code is from forexfactory calendar indicator:
// Main Webscraping function // ~~~~~~~~~~~~~~~~~~~~~~~~~ // bool GrabWeb(string strUrl, string& strWebPage) // returns the text of any webpage. Returns false on timeout or other error // // Parsing functions // ~~~~~~~~~~~~~~~~~ // string GetData(string strWebPage, int nStart, string strLeftTag, string strRightTag, int& nPos) // obtains the text between two tags found after nStart, and sets nPos to the end of the second tag // // void Goto(string strWebPage, int nStart, string strTag, int& nPos) // Sets nPos to the end of the first tag found after nStart bool bWinInetDebug = false; int hSession_IEType; int hSession_Direct; int Internet_Open_Type_Preconfig = 0; int Internet_Open_Type_Direct = 1; int Internet_Open_Type_Proxy = 3; int Buffer_LEN = 13; #import "wininet.dll" #define INTERNET_FLAG_PRAGMA_NOCACHE 0x00000100 // Forces the request to be resolved by the origin server, even if a cached copy exists on the proxy. #define INTERNET_FLAG_NO_CACHE_WRITE 0x04000000 // Does not add the returned entity to the cache. #define INTERNET_FLAG_RELOAD 0x80000000 // Forces a download of the requested file, object, or directory listing from the origin server, not from the cache. int InternetOpenA( string sAgent, int lAccessType, string sProxyName="", string sProxyBypass="", int lFlags=0 ); int InternetOpenUrlA( int hInternetSession, string sUrl, string sHeaders="", int lHeadersLength=0, int lFlags=0, int lContext=0 ); int InternetReadFile( int hFile, string sBuffer, int lNumBytesToRead, int& lNumberOfBytesRead[] ); int InternetCloseHandle( int hInet ); #import int hSession(bool Direct) { string InternetAgent; if (hSession_IEType == 0) { InternetAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)"; hSession_IEType = InternetOpenA(InternetAgent, Internet_Open_Type_Preconfig, "0", "0", 0); hSession_Direct = InternetOpenA(InternetAgent, Internet_Open_Type_Direct, "0", "0", 0); } if (Direct) { return(hSession_Direct); } else { return(hSession_IEType); } } bool GrabWeb(string strUrl, string& strWebPage) { int hInternet; int iResult; int lReturn[]={1}; string sBuffer="x"; int bytes; hInternet = InternetOpenUrlA(hSession(FALSE), strUrl, "0", 0, INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_RELOAD, 0); if (bWinInetDebug) Log("hInternet: " + hInternet); if (hInternet == 0) return(false); iResult = InternetReadFile(hInternet, sBuffer, Buffer_LEN, lReturn); if (bWinInetDebug) Log("iResult: " + iResult); if (bWinInetDebug) Log("lReturn: " + lReturn[0]); if (bWinInetDebug) Log("iResult: " + iResult); if (bWinInetDebug) Log("sBuffer: " + sBuffer); if (iResult == 0) return(false); bytes = lReturn[0]; strWebPage = StringSubstr(sBuffer, 0, lReturn[0]); // If there's more data then keep reading it into the buffer while (lReturn[0] != 0) { iResult = InternetReadFile(hInternet, sBuffer, Buffer_LEN, lReturn); if (lReturn[0]==0) break; bytes = bytes + lReturn[0]; strWebPage = strWebPage + StringSubstr(sBuffer, 0, lReturn[0]); } iResult = InternetCloseHandle(hInternet); if (iResult == 0) return(false); if (bWinInetDebug) { Log("iResult: " + iResult); int handle = FileOpen("Grabweb.htm",FILE_BIN|FILE_READ|FILE_WRITE); FileWriteString(handle,strWebPage,StringLen(strWebPage)); FileClose(handle); } return(true); }
nickbilak:
this code is from forexfactory calendar indicator:
hello, any idea how to set timeout period for InternetOpenUrlA. It seams to hang when website is down? Thanks, kar
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Right now, i use variables load from a file as parameter for several EA to comunicate. So far it works. Now i use the EA's on VPS.. i want to know if there's any method for EA's to access variables through website..
for example reading variable on http://www.testing.com/testVar.txt
it would be more easier for me to create and access the parameter...! hope it's possible...