How to get all the HTML of this page as a string?

Asked

Viewed 2,822 times

2

I’m doing a college job and with that trying to read the HTML of a Bradesco page(Link I want HTML here)

The problem is that I can’t get the HTML inside the frames and I don’t know how to get it.

Currently what I’m trying to do to get HTML is:

using System.IO;
using System.Net;

namespace ConsoleApplication1325423423423
{
public class Program
{
    private static void Main(string[] args)
    {
        string url = "https://wwwss.shopinvest.com.br/infofundos/fundos/TabelaRentabilidade.do?cdSgmtoProdt=1";

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        request.Method = WebRequestMethods.Http.Get;
        request.Accept = "application/json";

        WebResponse response = request.GetResponse();
        Stream dataStream = response.GetResponseStream();
        StreamReader reader = new StreamReader(dataStream);
        string responseFromServer = reader.ReadToEnd();
    }
}
}

And the return on the server response is: inserir a descrição da imagem aqui

Basically, what I need is a way to get HTML inside the frame tag with the name frmMeio.

<frame name="frmMeio" src="ConteudoTabelaRentabilidade.do?cdSgmtoProdt=1">
  • 2

    I don’t know if it helps, but you tried to change the variable url to get only the profitability table data? Something like: string url = "https://wwwss.shopinvest.com.br/infofundos/fundos/ConteudoTabelaRentabilidade.do?cdSgmtoProdt=1"; The result you will get is this one.

  • partner, put this as a question so I can give you credit!

  • I had tried to put the url + "Contentability.do? cdSgmtoProdt=1", but I hadn’t tried that! Thanks!

1 answer

2


According to the comment, the solution is to change the variable url to take only data from the profitability table, which is contained in the iframe.

The command line is as follows::

string url ="https://wwwss.shopinvest.com.br/infofundos/fundos/ConteudoTabelaRentabilidade.d‌​o?cdSgmtoProdt=1";

The result obtained with the change can be accessed here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.