• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

Data scraping from the website

Hi Experts, I wanted to scrape the data from the website http://www.forexfactory.com. I want to extract the data from the Today's Calendar section of the following columns: Date, Time, Currency, New description, high impact to the Excel spreadsheet.

Please advice me on to code this in VB.NET.

TIA.
0
bpyeo
Asked:
bpyeo
  • 2
1 Solution
 
Praveen KumarArchitectCommented:
This need some homework. but if you have have enough time you can do yourself. Just study the HttpWebRequest and HttpWebRespose classes which are defined in System.Net.
There is lot of articles in internet, best of luck.
0
 
bpyeoAuthor Commented:
Any website that provides an example code for the purpose? Please let me know.
0
 
Praveen KumarArchitectCommented:
Exact source code you may not get, but you can search EE and google for articles on HttpWebRequest and HttpWebResponse classes. They used send requests to websites and get responses from them. Once you got website html code into your application, you have to play with it to get data as u required.

For examle here is (C# - easy to convert) function will get html string from your site.

private String PostData(string url)
        {
            String result = "";
            String strPost = "If any Paramerets add here";
            StreamWriter myWriter = null;

            HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
            objRequest.Method = "POST";
            objRequest.ContentLength = strPost.Length;
            objRequest.ContentType = "application/x-www-form-urlencoded";

            try
            {
                myWriter = new StreamWriter(objRequest.GetRequestStream());
                myWriter.Write(strPost);
            }
            catch (Exception e)
            {
                return e.Message;
            }
            finally
            {
                myWriter.Close();
            }

            HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
            using (StreamReader sr =
               new StreamReader(objResponse.GetResponseStream()))
            {
                result = sr.ReadToEnd();

                // Close and clean up the StreamReader
                sr.Close();
            }
            return result;
        }  
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now