Retrieving data from a webpage
-
I am trying to retreive data from a webpage with a label saying "export". The data is partially showing on the screen, if I manually click on "export" a window comes up and ask to save, save as, or cancel. I then save all data to my computer as a csv file. However when trying to get the data using c# I get the code behind "export" and not the data, code starts out as "". I am using the following code:
WebClient webClient = new WebClient();
webClient.UseDefaultCredentials = false;
webClient.Credentials = new NetworkCredential(strUsername, strPassword);
webClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
webClient.DownloadFile(url, @strOutputFile);*note url is for "export". Can someone please point me in the right direction. Any help will be greatly appreciated. Thanks in advance. Michael
-
I am trying to retreive data from a webpage with a label saying "export". The data is partially showing on the screen, if I manually click on "export" a window comes up and ask to save, save as, or cancel. I then save all data to my computer as a csv file. However when trying to get the data using c# I get the code behind "export" and not the data, code starts out as "". I am using the following code:
WebClient webClient = new WebClient();
webClient.UseDefaultCredentials = false;
webClient.Credentials = new NetworkCredential(strUsername, strPassword);
webClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
webClient.DownloadFile(url, @strOutputFile);*note url is for "export". Can someone please point me in the right direction. Any help will be greatly appreciated. Thanks in advance. Michael
-
-
-
One thing might be happening here is that the website expects you to reach to file from the page where the button is. Can you add appropriate (that page's URL) referrer header to your request and check?
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]
-
One thing might be happening here is that the website expects you to reach to file from the page where the button is. Can you add appropriate (that page's URL) referrer header to your request and check?
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[^]
The following is the website: "http://finviz.com/screener.ashx?v=150&ft=4" however you have to pay for the service to get data, which will be "http://elite.finviz.com/screener.ashx?v=150&ft=4". Find the button export the url on that is "http://elite.finviz.com/export.ashx?v=150&ft=4" This is the actual url I use then add or don't add ".csv". if I enter the url in my browsers command line, the file is downloaded, but when I use c# I get html code.
-
I am trying to retreive data from a webpage with a label saying "export". The data is partially showing on the screen, if I manually click on "export" a window comes up and ask to save, save as, or cancel. I then save all data to my computer as a csv file. However when trying to get the data using c# I get the code behind "export" and not the data, code starts out as "". I am using the following code:
WebClient webClient = new WebClient();
webClient.UseDefaultCredentials = false;
webClient.Credentials = new NetworkCredential(strUsername, strPassword);
webClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
webClient.DownloadFile(url, @strOutputFile);*note url is for "export". Can someone please point me in the right direction. Any help will be greatly appreciated. Thanks in advance. Michael