Programming Examples

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

C Examples

Bounced Mail
Bz2
Certificates/Keys
Charset
CSV
DKIM / DomainKey
Diffie-Hellman
DSA
Email Object
Encryption
FileAccess
FTP
HTML Conversion
HTTP
IMAP
MHT / HTML Email
MIME
NTLM
POP3
RSA
SMTP
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
Tar
Upload
XML
Zip
Amazon S3

 

 

 

 

 

 

 

 

Must-Match Patterns

You may restrict the spider to only follow links that match any one of a set of "must-match" wildcard patterns. The AddMustMatchPattern can be called repeatedly to add must-match patterns.

Downloads:

MS Windows Visual C/C++ Libraries
Linux/CentOS C/C++ Libraries
MAC OS X C/C++ Libraries
Solaris C/C++ Libraries
C++ Builder Libraries
#include <C_CkSpider.h>

void ChilkatSample(void)
    {
    HCkSpider spider;
    BOOL success;
    long i;
    const char * url;

    //  The Chilkat Spider component/library is free.
    spider = CkSpider_Create();

    //  First, we'll get the outbound links for a page in the
    //  Google directory.  Then we'll add some must-match
    //  and then re-fetch, to see it work...

    CkSpider_Initialize(spider,"directory.google.com");
    CkSpider_AddUnspidered(spider,"http://directory.google.com/Top/Recreation/Outdoors/Hiking/Backpacking/");

    success = CkSpider_CrawlNext(spider);

    //  Display the outbound links

    for (i = 0; i <= CkSpider_getNumOutboundLinks(spider) - 1; i++) {
        printf("%s\n",CkSpider_getOutboundLink(spider,i));
    }

    //  The output:
    //  http://www.backpacker.com
    //  http://www.cmc.org
    //  http://www.backpacking.net
    //  http://www.thebackpacker.com/
    //  http://www.rei.com/online/store/LearnShareArticlesList?categoryId=Camping
    //  http://www.trailspace.com/
    //  http://www.catskillhikes.com/
    //  http://gorp.away.com/gorp/location/asia/nepal/favpicks.htm
    //  http://www.backpackinglight.com/cgi-bin/backpackinglight/index.html
    //  http://www.yetizone.com/
    //  http://www.backpackingfun.com
    //  http://www.freezerbagcooking.com/
    //  http://www.spadout.com/backpacking/
    //  http://sierrabackpacker.com
    //  http://www.abovecalifornia.com/
    //  http://www.personal.psu.edu/faculty/r/p/rpc1/bbb/
    //  http://www.thebackpackersguide.com
    //  http://www.journeywest.com/WB/index.html
    //  http://www.johann-sandra.com/backpackdir.htm
    //  http://www.geocities.com/amytys/
    //  http://www.cloudwalkersbasecamp.com
    //  http://www.netbackpacking.com
    //  http://members.tripod.com/~stooges/
    //  http://www.thebackpackingsite.com
    //  http://www.thruhikers.com/
    //  http://www.redcompservices.com/AT/
    //  http://members.aol.com/CMorHiker/backpack
    //  http://mywebpages.comcast.net/midwestpacker/
    //  http://www.midwesthiker.com/
    //  http://www.WeBackpack.com
    //  http://www.michiganhiker.com
    //  http://www.host33.com/backpack/
    //  http://www.wilderness-backpacking.com
    //  http://www.thetravelmonkey.net
    //  http://dmoz.org/cgi-bin/add.cgi?where=Recreation/Outdoors/Hiking/Backpacking
    //  http://dmoz.org/about.html
    //  http://dmoz.org/cgi-bin/apply.cgi?where=Recreation/Outdoors/Hiking/Backpacking
    //  http://dmoz.org
    //  http://dmoz.org/profiles/cdog.html
    //  http://dmoz.org/profiles/justinwp.html

    //  Do it again, but this time with avoid patterns.
    CkSpider_Initialize(spider,"directory.google.com");
    CkSpider_AddUnspidered(spider,"http://directory.google.com/Top/Recreation/Outdoors/Hiking/Backpacking/");

    //  Add some must-match patterns:
    CkSpider_AddMustMatchPattern(spider,"*.com/*");
    CkSpider_AddMustMatchPattern(spider,"*.net/*");

    //  Add some avoid-patterns:
    CkSpider_AddAvoidOutboundLinkPattern(spider,"*.mypages.*");
    CkSpider_AddAvoidOutboundLinkPattern(spider,"*.personal.*");
    CkSpider_AddAvoidOutboundLinkPattern(spider,"*.comcast.*");
    CkSpider_AddAvoidOutboundLinkPattern(spider,"*.aol.*");
    CkSpider_AddAvoidOutboundLinkPattern(spider,"*~*");

    success = CkSpider_CrawlNext(spider);

    printf("-----------------------\n");

    //  Display the outbound links
    for (i = 0; i <= CkSpider_getNumOutboundLinks(spider) - 1; i++) {
        printf("%s\n",CkSpider_getOutboundLink(spider,i));
    }

    //  Output:
    //  http://www.thebackpacker.com/
    //  http://www.rei.com/online/store/LearnShareArticlesList?categoryId=Camping
    //  http://www.trailspace.com/
    //  http://www.catskillhikes.com/
    //  http://gorp.away.com/gorp/location/asia/nepal/favpicks.htm
    //  http://www.backpackinglight.com/cgi-bin/backpackinglight/index.html
    //  http://www.yetizone.com/
    //  http://www.freezerbagcooking.com/
    //  http://www.spadout.com/backpacking/
    //  http://www.abovecalifornia.com/
    //  http://www.journeywest.com/WB/index.html
    //  http://www.johann-sandra.com/backpackdir.htm
    //  http://www.geocities.com/amytys/
    //  http://www.thruhikers.com/
    //  http://www.redcompservices.com/AT/
    //  http://www.midwesthiker.com/
    //  http://www.host33.com/backpack/


    CkSpider_Dispose(spider);

    }

Need a specific example? Send a request to support@chilkatsoft.com

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