C# - Get Source of a HTML Page
Simple C# bases software which a user enters the website url and this software retreives the source code and puts it into a text box, you could use this to scrape information from google and then extract specific items/information you want.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; // Included System.Net Class using System.Net; namespace getsauce { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { // Create a new webclient System.Net.WebClient newClient = new System.Net.WebClient(); newClient.Proxy = null; // Check if textbox1 contains 'http://' <- is required if (textBox1.Text.Contains("http://")) { // Create new variable, which downloads the website source string getsauce = newClient.DownloadString(textBox1.Text); // Put downloaded source into textbox textBox2.Text = getsauce.ToString(); } // Else we'll add then download source else { // Add 'http://' then download page source, and put in textbox textBox1.Text = "http://" + textBox1.Text; // Download source string getsauce = newClient.DownloadString(textBox1.Text); // Display source into textbox textBox2.Text = getsauce.ToString(); } } } }
http://www.coderzspot.com/index.php?...f-a-html-page/
-
vick2011 -
Thanks
{{ DiscussionBoard.errors[4783381].message }} -
-
liamweb -
Thanks - 1 reply
{{ DiscussionBoard.errors[4828091].message }}-
andrejvasso -
Thanks
{{ DiscussionBoard.errors[4832739].message }} -
-