Post: [C#] - Grab a website source!
02-06-2012, 02:54 AM #1
Correy
I'm the Original
(adsbygoogle = window.adsbygoogle || []).push({}); this is very easy,
it was a requested an i figured a few people may find this useful.

    
[COLOR="#0000CD"]using[/COLOR] System.Net;


put this void somewhere in your class.
    
[COLOR="#0000CD"]private void[/COLOR] GetSource( [COLOR="#0000CD"]string[/COLOR] Website )
{
[COLOR="#0000CD"]try[/COLOR]
{
[COLOR="#0000CD"]var[/COLOR] Source = [COLOR="#0000CD"]new[/COLOR] [COLOR="#40E0D0"]WebClient[/COLOR]().DownloadString( Website );
}
[COLOR="#0000CD"]catch[/COLOR]( [COLOR="#40E0D0"]Exception[/COLOR] x )
{
[COLOR="#40E0D0"]MessageBox[/COLOR].Show( "[COLOR="#FF0000"]Some Sort Off Error Occured![/COLOR]" );
}
}


call it however, just like this.
    
[COLOR="#0000CD"]GetSource[/COLOR]( "[COLOR="#FF0000"][B]Website URL[/B][/COLOR]" );
Last edited by Correy ; 02-06-2012 at 02:56 AM.

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo