Click here to Skip to main content
15,900,258 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I want to pull data from a website ??
all the data in some table and not have there id jast classes i try this:

i add the "HtmlAgilityPack" reference

if(!File.Exists("index.html"))
{
WebClient web2 = new WebClient();
web2.DownloadFile("http://www.beatport.com/genre/electro-house/17/top-100", "index.html");
}


HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.Load("index.html");


what you

What do you think the easiest way to do this?
Posted
Comments
Member 10631195 26-Jun-14 10:10am    
or jast try download string html sorce and then do Regular Expression to Match HTML
Sergey Alexandrovich Kryukov 26-Jun-14 14:45pm    
Do you want the easiest or the one which works? :-)
—SA

1 solution

I think this is what you are looking for it prints the html code of your requested page :
public static void Main(string[] args)
       {
           string URl = "http://www.beatport.com/genre/electro-house/17/top-100";

           WebClient client = new WebClient();

           client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");

           Stream data = client.OpenRead(URl);
           StreamReader reader = new StreamReader(data);
           string s = reader.ReadToEnd();

           Console.WriteLine(s);
           data.Close();
           reader.Close();
           Console.ReadKey();
       }


for more info refer to MSDN
http://msdn.microsoft.com/en-us/library/system.net.webclient.aspx[^]

Hope it helps
 
Share this answer
 
Comments
Member 10631195 26-Jun-14 13:54pm    
Thank you very much I hope it will help me understand what is going

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900