Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help with a script

    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.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    The way I'd do it is load the file into an array with the file() function.

    Then, loop through the array. Use a regular expression 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() function on your IP array.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •