Download MetaTrader 5
To add comments, please log in or register
All MQL5.community events are grouped together. Have a look at the Wall!
Tradeing Trader
556
Tradeing Trader 2014.02.19 10:03 

Hello,

i have find a example at https://www.mql5.com/en/code/1998 wich allows to load a website with MetaTrader and this example is from MQL5 and should work also in the new MT4 build.

But i am currently not enough experienced to make a simple working example, because the MQL5 language is still to new for me and wanted to ask here if somebody can show a simple example how to get a website back into a string.

Currently i have include the libaries into my program like this:

//+------------------------------------------------------------------+
//| Includes                                                         |
//+------------------------------------------------------------------+
#include <EasyXML\EasyXml.mqh>

Till there i have make everithink right and now there is the function/class loadXmlFromUrl(), and i have currently no idea how to use this, because its very different from old mql4, if somebody can make a example how to load a website into a string, that would be helpfull to understand it.

At the website from that script they have this example:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   // Create instance of class CEasyXml
   CEasyXml EasyXmlDocument;

   // Optional debugging
   EasyXmlDocument.setDebugging(true);

   // Set Url Cache File
   EasyXmlDocument.setUrlCacheFile("forexcalendar.xml");

   // Method 1: Load XML from URL
   if(EasyXmlDocument.loadXmlFromUrl("http://www.forexfactory.com/ffcal_week_this.xml"))
     {
      readRecursive(EasyXmlDocument.getDocumentRoot());
     }

   // Clear the DOM
   EasyXmlDocument.Clear();

   // Method 2: Load XML from string
   if(EasyXmlDocument.loadXmlFromString("<root><child attr='value'>content</child><sibling>siblingcontent</sibling></root>"))
     {
      readRecursive(EasyXmlDocument.getDocumentRoot());
     }

   // Clear the DOM
   EasyXmlDocument.Clear();

   // Method 3: Load XML from file
   if(EasyXmlDocument.loadXmlFromFile("forexcalendar.xml"))
     {
      readRecursive(EasyXmlDocument.getDocumentRoot());
     }
  }

But i just want to know how it must be make to load a website into a string, the other thinks from that example i dont need. Thanks for any help.

/
To add comments, please log in or register