/// <Summary>
/// Obtain remote file html
/// </Summary>
/// <Param name = "url"> </param>
/// <Returns> </returns>
Public Static String remotehtml (string URL)
{
Try
{
Webrequest bi = Webrequest. Create (URL );
Webresponse GBI = Bi. getresponse ();
// In this case, the received data stream is received. Therefore, a streamreader is required to read the data and set the encoding format during reading. Generally, it is set to the default format ..
// To use streamreader, you need to add reference using system. IO;
Streamreader RBI = New Streamreader (GBI. getresponsestream (), system. Text. encoding. Default );
String Str = RBI. readtoend ();
Return STR;
}
Catch
{
Return "" ;
}
}
Set the target htmlCodeGet to page
/// <Summary>
/// Obtain the remote file html
/// </Summary>
/// <Param name = "url"> </param>
/// <Returns> </returns>
Public static string remotehtml (string URL)
{
Try
{
Webrequest Bi = webrequest. Create (URL );
Webresponse GBI = Bi. getresponse ();
// At this time, the received data stream is received. Therefore, a streamreader is required to read data and set the encoding format during reading. Generally, it is set to the default format ..
// You need to add reference using system. Io when using streamreader;
Streamreader RBI = new streamreader (GBI. getresponsestream (), system. Text. encoding. Default );
String STR = RBI. readtoend ();
Return STR;
}
Catch
{
Return "";
}
}