.NET WEB-Services

Moderators: None (Apply to moderate this forum)
Number of threads: 20
Number of posts: 25

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
get the html source Posted by simion314 on 4 Dec 2006 at 3:19 PM
i need to create a program that can download from an www adress an html source. i need only the text in an html, no image and i need that the program be eficient. what tehnique shuld i use, i need to know http? are some classes in the net framework that can help me?

merci
simion314
Report
Re: get the html source Posted by cpravin on 5 Jan 2007 at 2:25 AM
: i need to create a program that can download from an www adress an html source. i need only the text in an html, no image and i need that the program be eficient. what tehnique shuld i use, i need to know http? are some classes in the net framework that can help me?
:
: merci
: simion314
:


Hi..
you need to use the Webclient class provided in the System.Net namespace. Use the following code...

using System.Net;
using System;
using System.Text;

public class Test
{
public static void Main()
{
WebClient c = new WebClient();
byte[] d = c.DownloadData("http://www.yahoo.com");
string download = Encoding.ASCII.GetString(d);
Console.WriteLine(download);
Console.Read();
}
}


its downloads and prints the yahoo home page

cheers :)





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.