...

View Full Version : Need help with a script



funkymonkeyboy
09-30-2006, 10:43 PM
Hello, I am a beginner in PHP.

I would like help in extracting IP addresses from a html text page.

http://www.anticheatinc.com/tex/MBLs/pbbans.txt

eg there are hundreds of IP addresses, but I only want to extract ones that are displayed more than once and display them on a separate output file.

Can anyone help me out.

Thanks.

Fumigator
09-30-2006, 11:14 PM
The way I'd do it is load the file into an array with the file() (http://us2.php.net/manual/en/function.file.php) function.

Then, loop through the array. Use a regular expression (http://us2.php.net/manual/en/ref.pcre.php) on each array element to isolate the IP address in the line and dump that into another array to create an array of IP addresses.

Then, I'd use the array_unique() (http://us2.php.net/manual/en/function.array-unique.php) function on your IP array.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum