1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Ip logging script help

Discussion in 'PHP' started by netpumber, Sep 28, 2009.

  1. netpumber

    netpumber New Member

    Joined:
    Nov 10, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Hallo guyz!! Im new here.. and im new in php coding.. So...

    I have this simple script that logs ips that visit my site in a local file.

    PHP:
    <?php
    $ip 
    $_SERVER['REMOTE_ADDR'];
    $page $_SERVER['REQUEST_URI'];
    $date date("d-m-y / H:i:s");
    $all $dae " - " $ip " - " $page "<br />";
    $fopen fopen("ips.txt""a");
    fwrite($fopen$all);
    fclose($fopen);
    ?>
    Now i want to add something more in this log file. I want to add the result of this link:

    hxxp://legacytools.dnsstuff.com/tools/ipall.ch?ip=x.x.x.x

    where x.x.x.x the ip that visits my site. Is it possible ? If yes.. please help me...

    Thanks ..!!
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,293
    Likes Received:
    365
    Trophy Points:
    83
    If you want the content of that page then you can use the fsockopen to get the content of the url but if you want them parse them use API or else too many query and they may ban your ip
     
  3. netpumber

    netpumber New Member

    Joined:
    Nov 10, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Ok... Thanks...for your answer..

    Lets say that it has logs some ips...Can i make the script to send the results in my email account ?
     
  4. mayz

    mayz New Member

    Joined:
    Dec 25, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Try the IP logging script at
    --1afm.net/scripts/catscript.php?catid=15--
    If you want it to email the IP to your email address add the following code below the script:
    $to = "info@youremail.com";
    $subject = "IP ADDRESS FROM YOUR SITE";
    $body = "Hi,\n\nA new IP addresss is " .$user_ip ;
    if (mail($to, $subject, $body)) {
    echo("<p>IP logged</p>");
    } else {
    echo("<p></p>");
    }
     

Share This Page