C# html source grabber

Discussion in 'Programming General' started by Gander, May 1, 2007.

C# html source grabber
  1. Unread #1 - May 1, 2007 at 6:20 PM
  2. Gander
    Referrals:
    0

    Gander Guest

    C# html source grabber

    Basicly this works like the URL function in Java.
    Code:
    
    using System;
    using System.IO;
    using System.Net;
    
    
    public class grabSource{
        
         public static void main(string[] args){
    String recieve;
                try
                {
                    WebRequest url = WebRequest.Create("http://google.com");
                    WebResponse response = url.GetResponse();
                    StreamReader input = new StreamReader(response.GetResponseStream());
                   recieve = input.ReadToEnd().ToString();
                    
    Console.WriteLine(recieve);
    url.Close();
    input.Close();
    response.Close();
                }
                catch(Exception ee){
          
    Console.WriteLine(ee.ToString());
    
      }
        }
    }
    Do with what you want w/ recieve.


    Also programming and teaching C# for runescape or paypal money.

    I'm also very familiar w/ php,html,mysql,D, And Java.


    Also some of you may know me, i'm very famous among Runescape private servers, I made (rs-server.net) Sadly, dead, I got fucked over by that nub Kevin ;)

    Anyway, enough of my life story, enjoy the tutorial
     
  3. Unread #2 - May 1, 2007 at 9:08 PM
  4. SidStudios
    Joined:
    Mar 14, 2007
    Posts:
    201
    Referrals:
    0
    Sythe Gold:
    0

    SidStudios Active Member

    C# html source grabber

    You could also achieve this by using a Webclient and using Webclient.download or something like that. After the webclient has finished downloading, you can make it show the HTML in a text box.

    That's for Visual C# .NET 2005 Express Edition and uses System.net as well.
     
< Program using Class structure | .net Lib Updates and Sample >

Users viewing this thread
1 guest


 
 
Adblock breaks this site