Need help with a messenger statistic script *please*

Discussion in 'PHP' started by peter33, May 5, 2006.

  1. #1
    Hi, i´d like to get a phpscript which looks if a icq user is currently online / offline or the state is changeing. This information should be send to me by email adress or to a file on my webserver or to my mysql db.


    This is all what i`ve got till now:
    $javascript = file_get_contents('http://icq.apper.de/12345678|online|offline.js')

    if ( strpos ( $javascript, 'online' ) !== false ) { // is online
    } else { // is offline or failure
    }

    (I could use a cronjob if this is necessary)

    I´m a total beginner please describe everthing in an easy way...

    Thanks for help!!


    ----
    Now i found this:
    $javascript = file_get_contents('http://icq.apper.de/12345678|online|offline.js')
    $text = date("d.m.Y - H:m ");
    if ( strpos ( $javascript, 'online' ) !== false ) {
    $text += 'online';
    } else {
    $text += 'offline';
    }
    $text += "\n";

    $log = fopen('./online.log', 'a');
    fwrite($log, $text);
    fclose($log);

    But it doesn´t work...
     
    peter33, May 5, 2006 IP
  2. Edmunds

    Edmunds Peon

    Messages:
    136
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try

    
    $javascript = file_get_contents('http://icq.apper.de/12345678|online|offline.js')
    $text = date("d.m.Y - H:m ");
    if ( strpos ( $javascript, 'online' ) !== false ) {
    $text += 'online';
    } else {
    $text += 'offline';
    }
    $text += "\n";
    
    [b]echo $text;[/b]
    
    $log = fopen('./online.log', 'a');
    fwrite($log, $text);
    fclose($log); 
    }
    
    Code (markup):
    and see if it prints out anything. You have to first identify where it's going wrong. It seems fine from here.
     
    Edmunds, May 5, 2006 IP