I'm trying to get the HTML code of the Google webpage in C# after something is searched (i.e. "http://ift.tt/2ixSo9Q"). I'm using WebRequest to get the HTML code from the webpage. But when I pull up the code, the webpage is missing details.
Here's my code (which probably has a lot of unnecessary stuff):
WebRequest request = WebRequest.Create("http://ift.tt/1Np4SUI" + textBox1.Text.Replace(" ", "%20"));
request.Credentials = CredentialCache.DefaultCredentials;
((HttpWebRequest)request).UserAgent = "Chrome 41.0.2228.0";
((HttpWebRequest)request).AllowAutoRedirect = true;
((HttpWebRequest)request).AuthenticationLevel = System.Net.Security.AuthenticationLevel.None;
((HttpWebRequest)request).KeepAlive = true;
WebResponse response = request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string dwnld = reader.ReadToEnd();
reader.Close();
When I search "asdf", the output from the code has 10,000 characters. When I search "asdf" on Google and launch inspect element, it has 416,000 characters.
How do I get the whole webpage? Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire