RE: [PHP] link counting

From: Date: Fri, 06 Apr 2007 13:13:49 +0000
Subject: RE: [PHP] link counting
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-252151@lists.php.net to get a copy of this message
[snip] i thought of an idea of counting the number of links to reduce comment spam. unfortunately my methods is not reliable, i haven't tested it yet though.. anyone have maybe a better solution using some regexp? $links = array('http://', 'https://', 'www.'); $total_links = 0; foreach($links as $link) { $total_links = substr_count($string, $link); } if($total_links > X) { ..... } [/snip] External links or internal links? Regardless, start with counting anchor tags. If you need to make it more granular you can work from there with regex.

« previous php.general (#252151) next »