---
product: Chilkat
product_version: 11.7.0
language: wc
language_label: Unicode C
class: Spider
license: free
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/wc_CkSpiderWRef.html
---
# Chilkat Spider — Unicode C — v11.7.0

> Chilkat 11.7.0 · language=wc · class=Spider
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/Spider.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/wc/guide.md`.

## Purpose

**Crawl a website domain, manage URL queues, filter links, cache pages, and inspect fetched HTML.**

`Chilkat.Spider` crawls pages within a single initialized domain. It maintains internal lists of unspidered, spidered, failed, and outbound URLs; fetches one page at a time; extracts same-domain links for continued crawling; collects outbound links separately; respects `robots.txt`; supports wildcard include and avoid patterns; can use a dedicated cache directory; and exposes the last fetched HTML, title, meta description, keywords, redirect information, cache status, and last-modified date.

**Domain-limited crawling**

Initialize the spider with a domain and crawl only URLs that belong to that same domain.

**URL queue management**

Add starting URLs, crawl the next queued URL, skip selected URLs, and inspect unspidered, spidered, failed, and outbound URL lists.

**Filtering rules**

Add wildcard avoid patterns, must-match patterns, and outbound-link avoid patterns to control which URLs are crawled or collected.

**Page metadata**

Read the last fetched HTML, page title, meta description, meta keywords, final redirect URL, and last-modified timestamp.

**Caching and redirects**

Fetch pages from a Chilkat-managed cache, update the cache, detect when a page was redirected, and inspect whether the last page came from cache.

**Network controls**

Configure user-agent, proxy settings, connect/read timeouts, IPv6 preference, maximum URL length, maximum response size, and abort support.

**Common pattern:** Call `Initialize` with the target domain, add one or more starting URLs with `AddUnspidered`, optionally add filtering patterns, then repeatedly call `CrawlNext`. After each successful crawl, inspect `LastUrl`, `LastHtml`, page metadata, redirect state, and the URL-list counts to decide whether to continue, skip, recrawl, or process the page.

**Scope note:** `Spider` is intended for controlled, domain-oriented crawling and link discovery. Use `Chilkat.Http` or `Chilkat.Rest` when the task is a single HTTP request, API call, form post, or download rather than a crawl of discovered links.

## Object creation, unlocking and error handling

**Create/Dispose**

```c
HCkSpiderW instance = CkSpiderW_Create();
// ...
CkSpiderW_Dispose(instance);
```

`HCkSpiderW CkSpiderW_Create(void);`

Creates an instance of the HCkSpiderW object and returns a handle ("void \*" pointer). The handle is passed in the 1st argument for the functions listed on this page.

`void CkSpiderW_Dispose(HCkSpiderW handle);`

Objects created by calling CkSpiderW_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkSpiderW_Dispose.

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in Unicode C.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `void CkSpiderW_getDebugLogFilePath(HCkSpiderW cHandle, HCkString retval); void CkSpiderW_putDebugLogFilePath(HCkSpiderW cHandle, const wchar_t *newVal); const wchar_t *CkSpiderW_debugLogFilePath(HCkSpiderW cHandle);` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastErrorHtml` | `void CkSpiderW_getLastErrorHtml(HCkSpiderW cHandle, HCkString retval); const wchar_t *CkSpiderW_lastErrorHtml(HCkSpiderW cHandle);` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `void CkSpiderW_getLastErrorText(HCkSpiderW cHandle, HCkString retval); const wchar_t *CkSpiderW_lastErrorText(HCkSpiderW cHandle);` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `void CkSpiderW_getLastErrorXml(HCkSpiderW cHandle, HCkString retval); const wchar_t *CkSpiderW_lastErrorXml(HCkSpiderW cHandle);` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `BOOL CkSpiderW_getLastMethodSuccess(HCkSpiderW cHandle); void CkSpiderW_putLastMethodSuccess(HCkSpiderW cHandle, BOOL newVal);` | read/write | Indicates the success or failure of the most recent method call: `TRUE` means success, `FALSE` means failure. |
| `VerboseLogging` | `BOOL CkSpiderW_getVerboseLogging(HCkSpiderW cHandle); void CkSpiderW_putVerboseLogging(HCkSpiderW cHandle, BOOL newVal);` | read/write | If set to `TRUE`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `void CkSpiderW_getVersion(HCkSpiderW cHandle, HCkString retval); const wchar_t *CkSpiderW_version(HCkSpiderW cHandle);` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `AbortCurrent` | property, read/write | `BOOL CkSpiderW_getAbortCurrent(HCkSpiderW cHandle); void CkSpiderW_putAbortCurrent(HCkSpiderW cHandle, BOOL newVal);` |
| `AvoidHttps` | property, read/write | `BOOL CkSpiderW_getAvoidHttps(HCkSpiderW cHandle); void CkSpiderW_putAvoidHttps(HCkSpiderW cHandle, BOOL newVal);` |
| `CacheDir` | property, read/write | `void CkSpiderW_getCacheDir(HCkSpiderW cHandle, HCkString retval); void CkSpiderW_putCacheDir(HCkSpiderW cHandle, const wchar_t *newVal); const wchar_t *CkSpiderW_cacheDir(HCkSpiderW cHandle);` |
| `ChopAtQuery` | property, read/write | `BOOL CkSpiderW_getChopAtQuery(HCkSpiderW cHandle); void CkSpiderW_putChopAtQuery(HCkSpiderW cHandle, BOOL newVal);` |
| `ConnectTimeout` | property, read/write | `int CkSpiderW_getConnectTimeout(HCkSpiderW cHandle); void CkSpiderW_putConnectTimeout(HCkSpiderW cHandle, int newVal);` |
| `Domain` | property, read-only | `void CkSpiderW_getDomain(HCkSpiderW cHandle, HCkString retval); const wchar_t *CkSpiderW_domain(HCkSpiderW cHandle);` |
| `FetchFromCache` | property, read/write | `BOOL CkSpiderW_getFetchFromCache(HCkSpiderW cHandle); void CkSpiderW_putFetchFromCache(HCkSpiderW cHandle, BOOL newVal);` |
| `FinalRedirectUrl` | property, read-only | `void CkSpiderW_getFinalRedirectUrl(HCkSpiderW cHandle, HCkString retval); const wchar_t *CkSpiderW_finalRedirectUrl(HCkSpiderW cHandle);` |
| `HeartbeatMs` | property, read/write | `int CkSpiderW_getHeartbeatMs(HCkSpiderW cHandle); void CkSpiderW_putHeartbeatMs(HCkSpiderW cHandle, int newVal);` |
| `LastFromCache` | property, read-only | `BOOL CkSpiderW_getLastFromCache(HCkSpiderW cHandle);` |
| `LastHtml` | property, read-only | `void CkSpiderW_getLastHtml(HCkSpiderW cHandle, HCkString retval); const wchar_t *CkSpiderW_lastHtml(HCkSpiderW cHandle);` |
| `LastHtmlDescription` | property, read-only | `void CkSpiderW_getLastHtmlDescription(HCkSpiderW cHandle, HCkString retval); const wchar_t *CkSpiderW_lastHtmlDescription(HCkSpiderW cHandle);` |
| `LastHtmlKeywords` | property, read-only | `void CkSpiderW_getLastHtmlKeywords(HCkSpiderW cHandle, HCkString retval); const wchar_t *CkSpiderW_lastHtmlKeywords(HCkSpiderW cHandle);` |
| `LastHtmlTitle` | property, read-only | `void CkSpiderW_getLastHtmlTitle(HCkSpiderW cHandle, HCkString retval); const wchar_t *CkSpiderW_lastHtmlTitle(HCkSpiderW cHandle);` |
| `LastModDateStr` | property, read-only | `void CkSpiderW_getLastModDateStr(HCkSpiderW cHandle, HCkString retval); const wchar_t *CkSpiderW_lastModDateStr(HCkSpiderW cHandle);` |
| `LastUrl` | property, read-only | `void CkSpiderW_getLastUrl(HCkSpiderW cHandle, HCkString retval); const wchar_t *CkSpiderW_lastUrl(HCkSpiderW cHandle);` |
| `MaxResponseSize` | property, read/write | `int CkSpiderW_getMaxResponseSize(HCkSpiderW cHandle); void CkSpiderW_putMaxResponseSize(HCkSpiderW cHandle, int newVal);` |
| `MaxUrlLen` | property, read/write | `int CkSpiderW_getMaxUrlLen(HCkSpiderW cHandle); void CkSpiderW_putMaxUrlLen(HCkSpiderW cHandle, int newVal);` |
| `NumAvoidPatterns` | property, read-only | `int CkSpiderW_getNumAvoidPatterns(HCkSpiderW cHandle);` |
| `NumFailed` | property, read-only | `int CkSpiderW_getNumFailed(HCkSpiderW cHandle);` |
| `NumOutboundLinks` | property, read-only | `int CkSpiderW_getNumOutboundLinks(HCkSpiderW cHandle);` |
| `NumSpidered` | property, read-only | `int CkSpiderW_getNumSpidered(HCkSpiderW cHandle);` |
| `NumUnspidered` | property, read-only | `int CkSpiderW_getNumUnspidered(HCkSpiderW cHandle);` |
| `PreferIpv6` | property, read/write | `BOOL CkSpiderW_getPreferIpv6(HCkSpiderW cHandle); void CkSpiderW_putPreferIpv6(HCkSpiderW cHandle, BOOL newVal);` |
| `ProxyDomain` | property, read/write | `void CkSpiderW_getProxyDomain(HCkSpiderW cHandle, HCkString retval); void CkSpiderW_putProxyDomain(HCkSpiderW cHandle, const wchar_t *newVal); const wchar_t *CkSpiderW_proxyDomain(HCkSpiderW cHandle);` |
| `ProxyLogin` | property, read/write | `void CkSpiderW_getProxyLogin(HCkSpiderW cHandle, HCkString retval); void CkSpiderW_putProxyLogin(HCkSpiderW cHandle, const wchar_t *newVal); const wchar_t *CkSpiderW_proxyLogin(HCkSpiderW cHandle);` |
| `ProxyPassword` | property, read/write | `void CkSpiderW_getProxyPassword(HCkSpiderW cHandle, HCkString retval); void CkSpiderW_putProxyPassword(HCkSpiderW cHandle, const wchar_t *newVal); const wchar_t *CkSpiderW_proxyPassword(HCkSpiderW cHandle);` |
| `ProxyPort` | property, read/write | `int CkSpiderW_getProxyPort(HCkSpiderW cHandle); void CkSpiderW_putProxyPort(HCkSpiderW cHandle, int newVal);` |
| `ReadTimeout` | property, read/write | `int CkSpiderW_getReadTimeout(HCkSpiderW cHandle); void CkSpiderW_putReadTimeout(HCkSpiderW cHandle, int newVal);` |
| `UpdateCache` | property, read/write | `BOOL CkSpiderW_getUpdateCache(HCkSpiderW cHandle); void CkSpiderW_putUpdateCache(HCkSpiderW cHandle, BOOL newVal);` |
| `UserAgent` | property, read/write | `void CkSpiderW_getUserAgent(HCkSpiderW cHandle, HCkString retval); void CkSpiderW_putUserAgent(HCkSpiderW cHandle, const wchar_t *newVal); const wchar_t *CkSpiderW_userAgent(HCkSpiderW cHandle);` |
| `WasRedirected` | property, read-only | `BOOL CkSpiderW_getWasRedirected(HCkSpiderW cHandle);` |
| `WindDownCount` | property, read/write | `int CkSpiderW_getWindDownCount(HCkSpiderW cHandle); void CkSpiderW_putWindDownCount(HCkSpiderW cHandle, int newVal);` |
| `AddAvoidOutboundLinkPattern` | method | `void CkSpiderW_AddAvoidOutboundLinkPattern(HCkSpiderW cHandle, const wchar_t *pattern);` |
| `AddAvoidPattern` | method | `void CkSpiderW_AddAvoidPattern(HCkSpiderW cHandle, const wchar_t *pattern);` |
| `AddMustMatchPattern` | method | `void CkSpiderW_AddMustMatchPattern(HCkSpiderW cHandle, const wchar_t *pattern);` |
| `AddUnspidered` | method | `void CkSpiderW_AddUnspidered(HCkSpiderW cHandle, const wchar_t *url);` |
| `CanonicalizeUrl` | method | `BOOL CkSpiderW_CanonicalizeUrl(HCkSpiderW cHandle, const wchar_t *url, const wchar_t *outStr); const wchar_t *CkSpiderW_canonicalizeUrl(HCkSpiderW cHandle, const wchar_t *url);` |
| `ClearFailedUrls` | method | `void CkSpiderW_ClearFailedUrls(HCkSpiderW cHandle);` |
| `ClearOutboundLinks` | method | `void CkSpiderW_ClearOutboundLinks(HCkSpiderW cHandle);` |
| `ClearSpideredUrls` | method | `void CkSpiderW_ClearSpideredUrls(HCkSpiderW cHandle);` |
| `CrawlNext` | method | `BOOL CkSpiderW_CrawlNext(HCkSpiderW cHandle);` |
| `FetchRobotsText` | method | `BOOL CkSpiderW_FetchRobotsText(HCkSpiderW cHandle, const wchar_t *outStr); const wchar_t *CkSpiderW_fetchRobotsText(HCkSpiderW cHandle);` |
| `GetAvoidPattern` | method | `BOOL CkSpiderW_GetAvoidPattern(HCkSpiderW cHandle, int index, const wchar_t *outStr); const wchar_t *CkSpiderW_getAvoidPattern(HCkSpiderW cHandle, int index);` |
| `GetBaseDomain` | method | `BOOL CkSpiderW_GetBaseDomain(HCkSpiderW cHandle, const wchar_t *domain, const wchar_t *outStr); const wchar_t *CkSpiderW_getBaseDomain(HCkSpiderW cHandle, const wchar_t *domain);` |
| `GetFailedUrl` | method | `BOOL CkSpiderW_GetFailedUrl(HCkSpiderW cHandle, int index, const wchar_t *outStr); const wchar_t *CkSpiderW_getFailedUrl(HCkSpiderW cHandle, int index);` |
| `GetOutboundLink` | method | `BOOL CkSpiderW_GetOutboundLink(HCkSpiderW cHandle, int index, const wchar_t *outStr); const wchar_t *CkSpiderW_getOutboundLink(HCkSpiderW cHandle, int index);` |
| `GetSpideredUrl` | method | `BOOL CkSpiderW_GetSpideredUrl(HCkSpiderW cHandle, int index, const wchar_t *outStr); const wchar_t *CkSpiderW_getSpideredUrl(HCkSpiderW cHandle, int index);` |
| `GetUnspideredUrl` | method | `BOOL CkSpiderW_GetUnspideredUrl(HCkSpiderW cHandle, int index, const wchar_t *outStr); const wchar_t *CkSpiderW_getUnspideredUrl(HCkSpiderW cHandle, int index);` |
| `GetUrlDomain` | method | `BOOL CkSpiderW_GetUrlDomain(HCkSpiderW cHandle, const wchar_t *url, const wchar_t *outStr); const wchar_t *CkSpiderW_getUrlDomain(HCkSpiderW cHandle, const wchar_t *url);` |
| `Initialize` | method | `void CkSpiderW_Initialize(HCkSpiderW cHandle, const wchar_t *domain);` |
| `LoadTaskCaller` | method | `BOOL CkSpiderW_LoadTaskCaller(HCkSpiderW cHandle, HCkTaskW task);` |
| `RecrawlLast` | method | `BOOL CkSpiderW_RecrawlLast(HCkSpiderW cHandle);` |
| `SkipUnspidered` | method | `void CkSpiderW_SkipUnspidered(HCkSpiderW cHandle, int index);` |
| `SleepMs` | method | `void CkSpiderW_SleepMs(HCkSpiderW cHandle, int numMilliseconds);` |

## Properties

### Spider.AbortCurrent

`Chilkat 11.7.0 · wc · Spider · AbortCurrent · property · read/write · since 9.5.0.58`

```c
BOOL CkSpiderW_getAbortCurrent(HCkSpiderW cHandle);
void CkSpiderW_putAbortCurrent(HCkSpiderW cHandle, BOOL newVal);
```

When set to `TRUE`, causes the currently running method to abort. Methods that always finish quickly (i.e.have no length file operations or network communications) are not affected. If no method is running, then this property is automatically reset to `FALSE` when the next method is called. When the abort occurs, this property is reset to `FALSE`. Both synchronous and asynchronous method calls can be aborted. (A synchronous method call could be aborted by setting this property from a separate thread.)

### Spider.AvoidHttps

`Chilkat 11.7.0 · wc · Spider · AvoidHttps · property · read/write`

```c
BOOL CkSpiderW_getAvoidHttps(HCkSpiderW cHandle);
void CkSpiderW_putAvoidHttps(HCkSpiderW cHandle, BOOL newVal);
```

If set the 1 (true) the spider will avoid all HTTPS URLs. The default is 0 (false).

### Spider.CacheDir

`Chilkat 11.7.0 · wc · Spider · CacheDir · property · read/write`

```c
void CkSpiderW_getCacheDir(HCkSpiderW cHandle, HCkString retval);
void CkSpiderW_putCacheDir(HCkSpiderW cHandle, const wchar_t *newVal);
const wchar_t *CkSpiderW_cacheDir(HCkSpiderW cHandle);
```

Specifies a cache directory to use for spidering. If either of the FetchFromCache or UpdateCache properties are true, this is the location of the cache to be used. Note: the Internet Explorer, Netscape, and FireFox caches are completely separate from the Chilkat Spider cache directory. You should specify a new and empty directory.

### Spider.ChopAtQuery

`Chilkat 11.7.0 · wc · Spider · ChopAtQuery · property · read/write`

```c
BOOL CkSpiderW_getChopAtQuery(HCkSpiderW cHandle);
void CkSpiderW_putChopAtQuery(HCkSpiderW cHandle, BOOL newVal);
```

If equal to 1 (true), then the query portion of all URLs are automatically removed when adding to the unspidered list. The default value is 0 (false).

### Spider.ConnectTimeout

`Chilkat 11.7.0 · wc · Spider · ConnectTimeout · property · read/write`

```c
int CkSpiderW_getConnectTimeout(HCkSpiderW cHandle);
void CkSpiderW_putConnectTimeout(HCkSpiderW cHandle, int newVal);
```

The maximum number of seconds to wait while connecting to an HTTP server.

### Spider.Domain

`Chilkat 11.7.0 · wc · Spider · Domain · property · read-only`

```c
void CkSpiderW_getDomain(HCkSpiderW cHandle, HCkString retval);
const wchar_t *CkSpiderW_domain(HCkSpiderW cHandle);
```

The domain name that is being spidered. This is the domain previously set in the Initialize method.

### Spider.FetchFromCache

`Chilkat 11.7.0 · wc · Spider · FetchFromCache · property · read/write`

```c
BOOL CkSpiderW_getFetchFromCache(HCkSpiderW cHandle);
void CkSpiderW_putFetchFromCache(HCkSpiderW cHandle, BOOL newVal);
```

If equal to 1 (true) then pages are fetched from cache when possible. If 0, the cache is ignored. The default value is 1. Regardless, if no CacheDir is set then the cache is not used.

### Spider.FinalRedirectUrl

`Chilkat 11.7.0 · wc · Spider · FinalRedirectUrl · property · read-only · since 9.5.0.85`

```c
void CkSpiderW_getFinalRedirectUrl(HCkSpiderW cHandle, HCkString retval);
const wchar_t *CkSpiderW_finalRedirectUrl(HCkSpiderW cHandle);
```

If the last URL crawled was redirected (as indicated by the WasRedirected property), this property will contain the final redirect URL.

### Spider.HeartbeatMs

`Chilkat 11.7.0 · wc · Spider · HeartbeatMs · property · read/write`

```c
int CkSpiderW_getHeartbeatMs(HCkSpiderW cHandle);
void CkSpiderW_putHeartbeatMs(HCkSpiderW cHandle, int newVal);
```

**Full documentation for this property (same in every language):** [Event Callback Examples](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/event_callback_examples.md)

The interval in milliseconds between each `AbortCheck` event callback, which enables an application to abort certain method calls before they complete. **By default, HeartbeatMs is set to** `0`**, meaning no AbortCheck event callbacks will trigger.**

### Spider.LastFromCache

`Chilkat 11.7.0 · wc · Spider · LastFromCache · property · read-only`

```c
BOOL CkSpiderW_getLastFromCache(HCkSpiderW cHandle);
```

Equal to 1 if the last page spidered was fetched from the cache. Otherwise equal to 0.

### Spider.LastHtml

`Chilkat 11.7.0 · wc · Spider · LastHtml · property · read-only`

```c
void CkSpiderW_getLastHtml(HCkSpiderW cHandle, HCkString retval);
const wchar_t *CkSpiderW_lastHtml(HCkSpiderW cHandle);
```

The HTML text of the last paged fetched by the spider.

### Spider.LastHtmlDescription

`Chilkat 11.7.0 · wc · Spider · LastHtmlDescription · property · read-only`

```c
void CkSpiderW_getLastHtmlDescription(HCkSpiderW cHandle, HCkString retval);
const wchar_t *CkSpiderW_lastHtmlDescription(HCkSpiderW cHandle);
```

The HTML META description from the last page fetched by the spider.

### Spider.LastHtmlKeywords

`Chilkat 11.7.0 · wc · Spider · LastHtmlKeywords · property · read-only`

```c
void CkSpiderW_getLastHtmlKeywords(HCkSpiderW cHandle, HCkString retval);
const wchar_t *CkSpiderW_lastHtmlKeywords(HCkSpiderW cHandle);
```

The HTML META keywords from the last page fetched by the spider.

### Spider.LastHtmlTitle

`Chilkat 11.7.0 · wc · Spider · LastHtmlTitle · property · read-only`

```c
void CkSpiderW_getLastHtmlTitle(HCkSpiderW cHandle, HCkString retval);
const wchar_t *CkSpiderW_lastHtmlTitle(HCkSpiderW cHandle);
```

The HTML title from the last page fetched by the spider.

### Spider.LastModDateStr

`Chilkat 11.7.0 · wc · Spider · LastModDateStr · property · read-only`

```c
void CkSpiderW_getLastModDateStr(HCkSpiderW cHandle, HCkString retval);
const wchar_t *CkSpiderW_lastModDateStr(HCkSpiderW cHandle);
```

The last modification date/time (RFC822 format) from the last page fetched by the spider.

### Spider.LastUrl

`Chilkat 11.7.0 · wc · Spider · LastUrl · property · read-only`

```c
void CkSpiderW_getLastUrl(HCkSpiderW cHandle, HCkString retval);
const wchar_t *CkSpiderW_lastUrl(HCkSpiderW cHandle);
```

The URL of the last page spidered.

### Spider.MaxResponseSize

`Chilkat 11.7.0 · wc · Spider · MaxResponseSize · property · read/write`

```c
int CkSpiderW_getMaxResponseSize(HCkSpiderW cHandle);
void CkSpiderW_putMaxResponseSize(HCkSpiderW cHandle, int newVal);
```

The maximum HTTP response size allowed. The spider will automatically fail any pages larger than this size. The default value is 250,000 bytes.

### Spider.MaxUrlLen

`Chilkat 11.7.0 · wc · Spider · MaxUrlLen · property · read/write`

```c
int CkSpiderW_getMaxUrlLen(HCkSpiderW cHandle);
void CkSpiderW_putMaxUrlLen(HCkSpiderW cHandle, int newVal);
```

The maximum URL length allowed. URLs longer than this are not added to the unspidered list. The default value is 200.

### Spider.NumAvoidPatterns

`Chilkat 11.7.0 · wc · Spider · NumAvoidPatterns · property · read-only`

```c
int CkSpiderW_getNumAvoidPatterns(HCkSpiderW cHandle);
```

The number of avoid patterns previously set by calling AddAvoidPattern.

### Spider.NumFailed

`Chilkat 11.7.0 · wc · Spider · NumFailed · property · read-only`

```c
int CkSpiderW_getNumFailed(HCkSpiderW cHandle);
```

The number of URLs in the object's failed URL list.

### Spider.NumOutboundLinks

`Chilkat 11.7.0 · wc · Spider · NumOutboundLinks · property · read-only`

```c
int CkSpiderW_getNumOutboundLinks(HCkSpiderW cHandle);
```

The number of URLs in the object's outbound links URL list.

### Spider.NumSpidered

`Chilkat 11.7.0 · wc · Spider · NumSpidered · property · read-only`

```c
int CkSpiderW_getNumSpidered(HCkSpiderW cHandle);
```

The number of URLs in the object's already-spidered URL list.

### Spider.NumUnspidered

`Chilkat 11.7.0 · wc · Spider · NumUnspidered · property · read-only`

```c
int CkSpiderW_getNumUnspidered(HCkSpiderW cHandle);
```

The number of URLs in the object's unspidered URL list.

### Spider.PreferIpv6

`Chilkat 11.7.0 · wc · Spider · PreferIpv6 · property · read/write`

```c
BOOL CkSpiderW_getPreferIpv6(HCkSpiderW cHandle);
void CkSpiderW_putPreferIpv6(HCkSpiderW cHandle, BOOL newVal);
```

If `TRUE`, then use IPv6 over IPv4 when both are supported for a particular domain. The default value of this property is `FALSE`, which will choose IPv4 over IPv6.

### Spider.ProxyDomain

`Chilkat 11.7.0 · wc · Spider · ProxyDomain · property · read/write`

```c
void CkSpiderW_getProxyDomain(HCkSpiderW cHandle, HCkString retval);
void CkSpiderW_putProxyDomain(HCkSpiderW cHandle, const wchar_t *newVal);
const wchar_t *CkSpiderW_proxyDomain(HCkSpiderW cHandle);
```

The domain name of a proxy host if an HTTP proxy is used.

### Spider.ProxyLogin

`Chilkat 11.7.0 · wc · Spider · ProxyLogin · property · read/write`

```c
void CkSpiderW_getProxyLogin(HCkSpiderW cHandle, HCkString retval);
void CkSpiderW_putProxyLogin(HCkSpiderW cHandle, const wchar_t *newVal);
const wchar_t *CkSpiderW_proxyLogin(HCkSpiderW cHandle);
```

If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy login.

### Spider.ProxyPassword

`Chilkat 11.7.0 · wc · Spider · ProxyPassword · property · read/write`

```c
void CkSpiderW_getProxyPassword(HCkSpiderW cHandle, HCkString retval);
void CkSpiderW_putProxyPassword(HCkSpiderW cHandle, const wchar_t *newVal);
const wchar_t *CkSpiderW_proxyPassword(HCkSpiderW cHandle);
```

If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy password.

### Spider.ProxyPort

`Chilkat 11.7.0 · wc · Spider · ProxyPort · property · read/write`

```c
int CkSpiderW_getProxyPort(HCkSpiderW cHandle);
void CkSpiderW_putProxyPort(HCkSpiderW cHandle, int newVal);
```

The port number of a proxy server if an HTTP proxy is used.

### Spider.ReadTimeout

`Chilkat 11.7.0 · wc · Spider · ReadTimeout · property · read/write`

```c
int CkSpiderW_getReadTimeout(HCkSpiderW cHandle);
void CkSpiderW_putReadTimeout(HCkSpiderW cHandle, int newVal);
```

The maximum number of seconds to wait when reading from an HTTP server.

### Spider.UpdateCache

`Chilkat 11.7.0 · wc · Spider · UpdateCache · property · read/write`

```c
BOOL CkSpiderW_getUpdateCache(HCkSpiderW cHandle);
void CkSpiderW_putUpdateCache(HCkSpiderW cHandle, BOOL newVal);
```

If equal to 1 (true) then pages saved to the cache. If 0, the cache is ignored. The default value is 1. Regardless, if no CacheDir is set then the cache is not used.

### Spider.UserAgent

`Chilkat 11.7.0 · wc · Spider · UserAgent · property · read/write`

```c
void CkSpiderW_getUserAgent(HCkSpiderW cHandle, HCkString retval);
void CkSpiderW_putUserAgent(HCkSpiderW cHandle, const wchar_t *newVal);
const wchar_t *CkSpiderW_userAgent(HCkSpiderW cHandle);
```

The value of the HTTP user-agent header field to be sent with HTTP requests. This can be set to any desired value, but be aware that some websites may reject requests from unknown user agents.

### Spider.WasRedirected

`Chilkat 11.7.0 · wc · Spider · WasRedirected · property · read-only · since 9.5.0.85`

```c
BOOL CkSpiderW_getWasRedirected(HCkSpiderW cHandle);
```

Indicates whether the last URL crawled was redirected. (`TRUE` = yes, `FALSE` = no)

### Spider.WindDownCount

`Chilkat 11.7.0 · wc · Spider · WindDownCount · property · read/write`

```c
int CkSpiderW_getWindDownCount(HCkSpiderW cHandle);
void CkSpiderW_putWindDownCount(HCkSpiderW cHandle, int newVal);
```

The `wind-down` phase begins when this number of URLs has been spidered. When in the wind-down phase, no new URLs are added to the unspidered list. The default value is 0 which means that there is NO wind-down phase.

## Methods

### Spider.AddAvoidOutboundLinkPattern

`Chilkat 11.7.0 · wc · Spider · AddAvoidOutboundLinkPattern · method`

```c
void CkSpiderW_AddAvoidOutboundLinkPattern(HCkSpiderW cHandle, const wchar_t *pattern);
```

Adds a wildcarded pattern to prevent collecting matching outbound link URLs. For example, if `*google*` is added, then any outbound links containing the word `google` will be ignored. The `*` character matches zero or more of any character.

### Spider.AddAvoidPattern

`Chilkat 11.7.0 · wc · Spider · AddAvoidPattern · method`

```c
void CkSpiderW_AddAvoidPattern(HCkSpiderW cHandle, const wchar_t *pattern);
```

Adds a wildcarded pattern to prevent spidering matching URLs. For example, if `*register*` is added, then any url containing the word `register` is not spidered. The `*` character matches zero or more of any character.

### Spider.AddMustMatchPattern

`Chilkat 11.7.0 · wc · Spider · AddMustMatchPattern · method`

```c
void CkSpiderW_AddMustMatchPattern(HCkSpiderW cHandle, const wchar_t *pattern);
```

Adds a wildcarded pattern to limit spidering to only URLs that match the pattern. For example, if `*/products/*` is added, then only URLs containing `/products/` are spidered. This is helpful for only spidering a portion of a website. The `*` character matches zero or more of any character.

### Spider.AddUnspidered

`Chilkat 11.7.0 · wc · Spider · AddUnspidered · method`

```c
void CkSpiderW_AddUnspidered(HCkSpiderW cHandle, const wchar_t *url);
```

To begin spidering you must call this method one or more times to provide starting points. It adds a single URL to the object's internal queue of URLs to be spidered.

### Spider.CanonicalizeUrl

`Chilkat 11.7.0 · wc · Spider · CanonicalizeUrl · method`

```c
BOOL CkSpiderW_CanonicalizeUrl(HCkSpiderW cHandle, const wchar_t *url, const wchar_t *outStr);
const wchar_t *CkSpiderW_canonicalizeUrl(HCkSpiderW cHandle, const wchar_t *url);
```

Canonicalizes a URL by doing the following:

- Drops username/password if present.
- Drops fragment if present.
- Converts domain to lowercase.
- Removes port 80 or 443
- Remove default.asp, index.html, index.htm, default.html, index.htm, default.htm, index.php, index.asp, default.php, .cfm, .aspx, ,php3, .pl, .cgi, .txt, .shtml, .phtml
- Remove www. from the domain if present.

Returns TRUE for success, FALSE for failure.

### Spider.ClearFailedUrls

`Chilkat 11.7.0 · wc · Spider · ClearFailedUrls · method`

```c
void CkSpiderW_ClearFailedUrls(HCkSpiderW cHandle);
```

Clears the object's internal list of URLs that could not be downloaded.

### Spider.ClearOutboundLinks

`Chilkat 11.7.0 · wc · Spider · ClearOutboundLinks · method`

```c
void CkSpiderW_ClearOutboundLinks(HCkSpiderW cHandle);
```

Clears the object's internal list of outbound URLs that will automatically accumulate while spidering.

### Spider.ClearSpideredUrls

`Chilkat 11.7.0 · wc · Spider · ClearSpideredUrls · method`

```c
void CkSpiderW_ClearSpideredUrls(HCkSpiderW cHandle);
```

Clears the object's internal list of already-spidered URLs that will automatically accumulate while spidering.

### Spider.CrawlNext

`Chilkat 11.7.0 · wc · Spider · CrawlNext · method`

```c
BOOL CkSpiderW_CrawlNext(HCkSpiderW cHandle);
```

Crawls the next URL in the internal list of unspidered URLs. The URL is moved from the unspidered list to the spidered list. Any new links within the same domain and not yet spidered are added to the unspidered list. (providing that they do not match `avoid` patterns, etc.) Any new outbound links are added to the outbound URL list. If successful, the HTML of the downloaded page is available in the LastHtml property. If there are no more URLs left unspidered, the method returns `FALSE`. Information about the URL crawled is available in the properties LastUrl, LastFromCache, and LastModDate.

Async variant: `CrawlNextAsync` — same arguments, returns a `Task` (see Async variants below).

### Spider.FetchRobotsText

`Chilkat 11.7.0 · wc · Spider · FetchRobotsText · method`

```c
BOOL CkSpiderW_FetchRobotsText(HCkSpiderW cHandle, const wchar_t *outStr);
const wchar_t *CkSpiderW_fetchRobotsText(HCkSpiderW cHandle);
```

Returns the contents of the robots.txt file from the domain being crawled. This spider object will not crawl URLs excluded by robots.txt. If you believe the spider is not behaving correctly, please notify us at support@chilkatsoft.com and provide information detailing a case that allows us to reproduce the problem.

Returns TRUE for success, FALSE for failure.

Async variant: `FetchRobotsTextAsync` — same arguments, returns a `Task` (see Async variants below).

### Spider.GetAvoidPattern

`Chilkat 11.7.0 · wc · Spider · GetAvoidPattern · method`

```c
BOOL CkSpiderW_GetAvoidPattern(HCkSpiderW cHandle, int index, const wchar_t *outStr);
const wchar_t *CkSpiderW_getAvoidPattern(HCkSpiderW cHandle, int index);
```

Returns the Nth avoid pattern previously added by calling AddAvoidPattern. Indexing begins at 0.

Returns TRUE for success, FALSE for failure.

### Spider.GetBaseDomain

`Chilkat 11.7.0 · wc · Spider · GetBaseDomain · method`

```c
BOOL CkSpiderW_GetBaseDomain(HCkSpiderW cHandle, const wchar_t *domain, const wchar_t *outStr);
const wchar_t *CkSpiderW_getBaseDomain(HCkSpiderW cHandle, const wchar_t *domain);
```

Returns the second-level + top-level domain of the `domain`. For example, if `domain` is `xyz.example.com`, this returns `example.com`. For some domains, such as `xyz.example.co.uk`, the top 3 levels are returned, such as `example.co.uk`.

Returns TRUE for success, FALSE for failure.

### Spider.GetFailedUrl

`Chilkat 11.7.0 · wc · Spider · GetFailedUrl · method`

```c
BOOL CkSpiderW_GetFailedUrl(HCkSpiderW cHandle, int index, const wchar_t *outStr);
const wchar_t *CkSpiderW_getFailedUrl(HCkSpiderW cHandle, int index);
```

Returns the Nth URL in the failed URL list. Indexing begins at 0.

Returns TRUE for success, FALSE for failure.

### Spider.GetOutboundLink

`Chilkat 11.7.0 · wc · Spider · GetOutboundLink · method`

```c
BOOL CkSpiderW_GetOutboundLink(HCkSpiderW cHandle, int index, const wchar_t *outStr);
const wchar_t *CkSpiderW_getOutboundLink(HCkSpiderW cHandle, int index);
```

Returns the Nth URL in the outbound link URL list. Indexing begins at 0.

Returns TRUE for success, FALSE for failure.

### Spider.GetSpideredUrl

`Chilkat 11.7.0 · wc · Spider · GetSpideredUrl · method`

```c
BOOL CkSpiderW_GetSpideredUrl(HCkSpiderW cHandle, int index, const wchar_t *outStr);
const wchar_t *CkSpiderW_getSpideredUrl(HCkSpiderW cHandle, int index);
```

Returns the Nth URL in the already-spidered URL list. Indexing begins at 0.

Returns TRUE for success, FALSE for failure.

### Spider.GetUnspideredUrl

`Chilkat 11.7.0 · wc · Spider · GetUnspideredUrl · method`

```c
BOOL CkSpiderW_GetUnspideredUrl(HCkSpiderW cHandle, int index, const wchar_t *outStr);
const wchar_t *CkSpiderW_getUnspideredUrl(HCkSpiderW cHandle, int index);
```

Returns the Nth URL in the unspidered URL list. Indexing begins at 0.

Returns TRUE for success, FALSE for failure.

### Spider.GetUrlDomain

`Chilkat 11.7.0 · wc · Spider · GetUrlDomain · method`

```c
BOOL CkSpiderW_GetUrlDomain(HCkSpiderW cHandle, const wchar_t *url, const wchar_t *outStr);
const wchar_t *CkSpiderW_getUrlDomain(HCkSpiderW cHandle, const wchar_t *url);
```

Returns the domain name part of a URL. For example, if the URL is `https://www.chilkatsoft.com/test.asp`, then `www.chilkatsoft.com` is returned.

Returns TRUE for success, FALSE for failure.

### Spider.Initialize

`Chilkat 11.7.0 · wc · Spider · Initialize · method`

```c
void CkSpiderW_Initialize(HCkSpiderW cHandle, const wchar_t *domain);
```

Initializes the object to begin spidering a domain. Calling Initialize clears any patterns added via the AddAvoidOutboundLinkPattern, AddAvoidPattern, and AddMustMatchPattern methods. The domain name passed to this method is what is returned by the Domain property. The spider only crawls URLs within the same domain.

### Spider.LoadTaskCaller

`Chilkat 11.7.0 · wc · Spider · LoadTaskCaller · method · since 9.5.0.80`

```c
BOOL CkSpiderW_LoadTaskCaller(HCkSpiderW cHandle, HCkTaskW task);
```

Loads the caller of the task's async method.

Returns TRUE for success, FALSE for failure.

### Spider.RecrawlLast

`Chilkat 11.7.0 · wc · Spider · RecrawlLast · method`

```c
BOOL CkSpiderW_RecrawlLast(HCkSpiderW cHandle);
```

Re-crawls the last URL spidered. This helpful when cookies set in a previous page load cause the page to be loaded differently the next time.

Async variant: `RecrawlLastAsync` — same arguments, returns a `Task` (see Async variants below).

### Spider.SkipUnspidered

`Chilkat 11.7.0 · wc · Spider · SkipUnspidered · method`

```c
void CkSpiderW_SkipUnspidered(HCkSpiderW cHandle, int index);
```

Moves a URL from the unspidered list to the spidered list. This allows an application to skip a specific URL.

### Spider.SleepMs

`Chilkat 11.7.0 · wc · Spider · SleepMs · method`

```c
void CkSpiderW_SleepMs(HCkSpiderW cHandle, int numMilliseconds);
```

Suspends the execution of the current thread until the time-out interval elapses.

## Events and callbacks

This binding delivers progress information through callbacks (AbortCheck, PercentDone, ProgressInfo, TaskCompleted) rather than events. See `guide.md` for how to attach them in Unicode C.

## Async variants

Each returns a `Task` instead of the result and takes the same arguments as the synchronous method; run the task, wait for `Finished`, then read the result from the task. No new Async methods are added from 11.7.0 on.

```c
HCkTaskW CkSpiderW_CrawlNextAsync(HCkSpiderW cHandle);
HCkTaskW CkSpiderW_FetchRobotsTextAsync(HCkSpiderW cHandle);
HCkTaskW CkSpiderW_RecrawlLastAsync(HCkSpiderW cHandle);
```

## Related classes

[`Task`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/wc/classes/Task.md)

