Read an html page or php page with windows phone and get data

159 Views Asked by At

I'm trying to read a html or php page. I need to get all artists names of this page: http://www.unnu.com/music-artists please help me out with this. I'm trying at the moment using the HtmlAgilityPack but I can not get any data. Can anyone help me?

1

There are 1 best solutions below

0
Luiz Negrini On
 private void Artistas()
        {
             // acesso o site e recupero seu conteudo
            WebResponse response = WebRequest.Create("http://www.dmenezes.com.br").GetResponse();

            // aqui começa o uso da Html Agility Pack
            // crio um HtmlDocument com o conteudo do site já recuperado
            HtmlDocument doc = new HtmlDocument();
            doc.Load(response.GetResponseStream());


            // selecionando todos os links do menu principal, e mostrando seus endereços.

            var linksMenuPrincipal = doc.GetElementbyId("menu-principal").DescendantNodes().Where(x => x.Name == "a");

            foreach (HtmlNode link in linksMenuPrincipal)

            Console.WriteLine(String.Format("O endereço de [{0}] é {1}", link.Attributes["title"].Value, link.Attributes["href"].Value));
        }