Enter a URL to capture the webpage content, process it, and save it to the database. This should be the principle of the collector.
If you want to use C #, you need to use the WebClient class.
Meteorology
Using System;
Using System. Collections. Generic;
Using System. componentmodel;
Using System. Data;
Using System. drawing;
Using System. text;
Using System. Windows. forms;
UsingSystem. net;
NamespaceFirstwebclient
{
Public Partial ClassForm1: Form
{
PublicForm1 ()
{
Initializecomponent ();
}
Private Void Button#click ( Object Sender, eventargs E)
{
WebClient _ Client = New WebClient ();
_ Client. baseaddress = " Http://www.cnblogs.com " ;
_ Client. headers. Add ( " Accept " , " Image/GIF, image/X-xbitmap, image/JPEG, image/pjpeg, application/X-Shockwave-flash, application/vnd. MS-Excel, application/vnd. MS-PowerPoint, application/MSWord ,*/* " );
_ Client. headers. Add ( " Accept-Language " , " Zh-CN " );
_ Client. headers. Add ( " UA-CPU " , " X86 " );
// _ Client. headers. Add ("Accept-encoding", "gzip, deflate ");
_ Client. headers. Add ( " User-Agent " , " Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; sv1;. Net CLR 1.1.4322;. Net CLR 2.0.50727) " );
System. Io. Stream objstream = _ Client. openread ( " / " );
System. Io. streamreader _ read = New System. Io. streamreader (objstream, system. Text. encoding. utf8 );
Textbox1.text = _ Read. readtoend ();
}
}
}
Reference: http://www.cnblogs.com/titi/archive/2005/11/20/280914.html