Method: PHPCrawler::addLinkPriority()



Adds a regular expression togehter with a priority-level to the list of rules that decide what links should be prefered.
Signature:

public addLinkPriority($regex, $level)

Parameters:

$regex string Regular expression definig the rule
$level int The priority-level

Returns:

bool  TRUE if a valid preg-pattern is given as argument and was succsessfully added, otherwise it returns FALSE.

Description:

Links/URLs that match an expression with a high priority-level will be followed before links with a lower level.
All links that don't match with any of the given rules will get the level 0 (lowest level) automatically.

The level can be any positive integer.

Example:

Telling the crawler to follow links that contain the string "forum" before links that contain ".gif" before all other found links.$crawler->addLinkPriority("/forum/", 10);
$cralwer->addLinkPriority("/\.gif/", 5);