C# Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C# Examples

Bounced Mail
Bz2
Character Encoding
CSV
DKIM / DomainKey
Digital Certificates
Digital Signatures
Email
Email Object
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression


More Examples...
Amazon S3
NTLM
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

Extract Message Subjects from Finance Message Board

Download Chilkat .NET for 4.0 Framework

Download Chilkat .NET for 64-bit 4.0 Framework (x64)

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 64-bit 2.0 / 3.5 Framework (x64)

Download Chilkat .NET for 1.0 / 1.1 Framework

This example shows how to use the Chilkat HTTP component to fetch the GOOG message board, convert it to XML, and then use Chilkat XML to iterate over each message link and extract each message subject. This example worked on 6-June-2005. Future changes in the HTML delivered by the source may break this code, but the purpose of the code is to demonstrate the ease of extracting information from HTML.

Chilkat.Http http = new Chilkat.Http();
http.UnlockComponent("HTTP 30-day trial");

// Make our HTTP client mimic Mozilla Firefox
http.MimicFireFox = true;

// Do not fetch from cache or save to cache.
http.FetchFromCache = false;
http.UpdateCache = false;
		
Chilkat.HtmlToXml conv = new Chilkat.HtmlToXml();
conv.UnlockComponent("Html-to-Xml 30-day trial");

// Get the HTML for the Google message board on Yahoo finance.		    
conv.Html = http.QuickGetStr("http://messages.yahoo.com/?action=q&board=GOOG");

// Convert it to XML and load it into Chilkat XML.
Chilkat.Xml xml = new Chilkat.Xml();
xml.LoadXml(conv.ToXml());

// Each message link has a hyperlink like this:
// <a href="/bbs?.mm=FN&action=m&board=1608859966&tid=goog&sid=1608859966&mid=221123">
Chilkat.Xml firstMsgLink = xml.SearchForAttribute(null,"a","href","*action=m*&mid=1");
Chilkat.Xml lastMsgLink = xml.SearchForAttribute(firstMsgLink,"a","href","*action=m*&mid=*");
Chilkat.Xml msgLink = xml.SearchForAttribute(lastMsgLink,"a","href","*action=m*&mid=*");

string subjects = "";
while (msgLink != null)
{
    string linkText = msgLink.GetChildContent("text");
    if (linkText.Equals("First")) break;
    subjects = subjects + linkText + "\r\n";
    
    // Scan for the next link.
    msgLink = xml.SearchForAttribute(msgLink,"a","href","*action=m*&mid=*");
}

MessageBox.Show(subjects);

Important: The download for this example does not contain the ChilkatDotNet.dll which
must be downloaded and installed separately at http://www.chilkatsoft.com/downloads.asp.
Once installed, add a reference to the DLL in the project by following the instructions at
http://www.example-code.com/vbdotnet/step2.asp

 

© 2000-2012 Chilkat Software, Inc. All Rights Reserved.

Email Component · XML Parser