I set up the following in the phone:

action_offhook_url!: http://abpusa.com/prov/snom/logger.php?mac={mac}&action=offhook
action_onhook_url!: http://abpusa.com/prov/snom/logger.php?mac={mac}&action=onhook

Now when I go offhook or onhook, the phone "browses" that url and posts those values to the page below.

{mac} doesn't work right now but we have a request into the developers to implement it.


Following is my logger.php page.

**************************************************************
<?php
define("DEBUG", "iON");
if (isset($_GET['action'])) {
        $action=$_GET['action'];
}
else {
        $action = "none";
}
if (isset($_GET['mac'])) {
        $mac=$_GET['mac'];
}
else {
        $mac = "not_posted";
}

$ip = $_SERVER['REMOTE_ADDR'];
$user_agent = $_SERVER["HTTP_USER_AGENT"];

if (!str_contains($user_agent, 'snom')) {
        $user_agent = "Not_a_Phone";
}

?>
<html>
<pre>
OK
<?php

$filename = 'logs/log.txt';
$script = "logger.php";
$mydate=date('Y-m-d H-i');
$somecontent = "$script\t$mydate\t$ip\t$mac\t$action\t$user_agent\n";

if ($user_agent == "Not_a_Phone"){
        Print_Log($somecontent, 'logs/pclog.txt');
}
else {
        Print_Log($somecontent, $filename);
}


function Print_Log($somecontent, $filename) {
        // Let's make sure the file exists and is writable first.
        if (is_writable($filename)) {
                if (!$handle = fopen($filename, 'a')) {
                        echo "Cannot open file ($filename)\n";
                         exit;
                }

                if (fwrite($handle, $somecontent) === FALSE) {
                        echo "Cannot write to file ($filename)\n";
                        exit;
                }

        fclose($handle);

        } else {
           echo "The file $filename is not writable\n";
        }
}

function str_contains($haystack, $needle, $ignoreCase = false) {
   if ($ignoreCase) {
       $haystack = strtolower($haystack);
       $needle  = strtolower($needle);
   }
   $needlePos = strpos($haystack, $needle);
   return ($needlePos === false ? false : ($needlePos+1));
}

?>
</pre>
<html>
**************************************************************