Share this page

# web_add_filter

Filter Functions

Sets criteria to include or exclude URLs when downloading (applies to the next action function).

    int web_add_filter( [Action,]< List of Attributes >, LAST ) ;

Argument | Description
--- | ---
Action | A value indicating whether to include or exclude URLs matching the filter criteria. The following values are supported: – Include: include only URLs which match the criteria – Exclude: exclude URLs which match the criteria. This is the default value
List of Attributes | For each attribute in the list, use the format `"AttributeName=`value". For details, see Attributes.
LAST | A marker indicating the end of the List of Attributes

## Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.

## Parameterization

All attributes from the list of attributes can be parameterized using standard parameterization.

## General Information

web_add_filter specifies a filter to be used when downloading content in the next action function. Depending on the Action attribute passed in this function, the filter will either include or exclude URLs containing the matching criteria. The default action is "Action=Exclude".

If the Port attribute is set, then only content whose source is that port is downloaded. If no port is specified, then all ports are considered a match.

## Attributes

URL – the specific URL to filter

UrlPrefix – Filter all URLs that begin with this string. For example,

"UrlPrefix = http://www.cc"

filters http://www.ccn.com, http://www.cc.edu, http://cc–nanochem.de, and any other URL that begins with "http://www.cc"

Host – URLs which include Host in the hostname portion of the URL path are filtered

HostPrefix – URLs which include this prefix in the hostname portion of the URL path are filtered

HostSuffix – URLs which include this suffix in the host name portion of the URL path are filtered

Path – URLs with the specified path are filtered

PathPrefix – URLs with the specified path prefix are filtered

PathSuffix – URLs with the specified path suffix are filtered

Port – URLs from the specified port are filtered

Scheme – URLs with the specified communications scheme, such as http, https and ftp, are filtered

Query – URLs with the specified query are filtered

QueryPrefix – URLs with the specified query prefix are filtered

QuerySuffix – URLs with the specified query suffix are filtered

FragmentId – URLs containing a matching fragment ID are filtered

FragmentIdPrefix – URLs containing a matching fragment ID prefix are filtered

FragmentIdSuffix – URLs containing a matching fragment ID suffix are filtered

## Example

The following example uses web_add_filter to exclude URLs with a path prefix of /Images/Upload. Since the call only applies to the next action function, the filter does not apply to the second call to web_url. All URLs with matching criteria will not be excluded.

Copy code

    // Call to web_add_filter only applies to the next action function
    web_add_filter("Action=Exclude", "PathPrefix=/Images/Upload",
    LAST );
    web_url("www.knanas.com",
        "URL=http://www.knanas.com/",
        "Resource=0",
        "RecContentType=text/html",
        "Referer=",
        "Snapshot=t1.inf",
        "Mode=HTML",
         EXTRARES,
         "Url=/images/netaction_icon.gif",
    ENDITEM,
         "Url=http://frontpage.knanas.com/Images/Upload/Commerce323.jpg",
    ENDITEM,
            // Will be excluded as it matches the path prefix criteria
            "Url=http://frontpage.knanas.com/Images/Upload/Commerce134.gif",
            ENDITEM,
            // Will be excluded as it matches the path prefix criteria
            "Url=http://frontpage.knanas.com/Images/Upload/120_eminem-t55.jpg",
             ENDITEM,
            // Will be excluded as it matches the path prefix criteria
            "Url=http://frontpage.knanas.com/Images/Upload/153_gavre_sigar.jpg",
             ENDITEM,
            // Will be excluded as it matches the path prefix criteria
            "Url=http://realmedia.knanas.com/RealMedia/ads/Creatives/default/empty.gif",
              ENDITEM,             LAST );
            // Out of scope of web_add_filter function
            web_url("www.knanas.com",
            "URL=http://www.knanas.com/",
            "Resource=0",
                 "RecContentType=text/html",
            "Referer=",
            "Snapshot=t1.inf",
            "Mode=HTML",
                 EXTRARES,
                 "Url=/images/netaction_icon.gif",
                 ENDITEM,
                 "Url=http://frontpage.knanas.com/Images/Upload/Commerce323.jpg",
                 ENDITEM,
                 // Will be included because the filter doesn't apply any more
                 "Url=http://frontpage.knanas.com/Images/Upload/Commerce134.gif",
             ENDITEM,
                 // Will be included
                 LAST );

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: