I am home.  Are you getting it working now?  Let me know.  The code I posted is old.  The new stuff I will post below:  
 
First here is the URL I use to run it: 
 
http://192.168.1.203/HaikuHelper.php?newTargetValue=1&DeviceNum=147  
 
this is to turn ON Device 147
 
http://192.168.1.203/HaikuHelper.php?newTargetValue=0&DeviceNum=147
 
this is to turn OFF Device 147.
 
Get this working and I will try to get dimming working for you.  Code is:
 
Here is the "good" code.  This does buttons and sets Cooling Temperature:
 
<?php
define('HHAPI_URL', 'IP_OF_HAIKUHELPER

ORT_OF_HAIKUHELPER port/api');
define('HHAPI_USER', 'USERNAME');
define('HHAPI_PASS', 'PASSWORD');
 
//  hhapi calls
 
// Grab the name and date properties from the controller object
if (isset($_GET["dim"])) { // Check to see if DIM is defined so run the DIM command
    hhapi('controller.unitWithNumber('.$_GET["DeviceNum"].').setLevel('.$_GET["dim"].')');
}
elseif(isset($_GET["newTargetValue"])) { //See If we are passing a unit number to turn on or off
   if ($_GET["newTargetValue"] == 1){ //Value is 1 so turn switch ON
        hhapi('controller.unitWithNumber('.$_GET["DeviceNum"].').on()');
   }
   elseif($_GET["newTargetValue"] == 0){ //Value is 0 so turn switch OFF
   hhapi('controller.unitWithNumber('.$_GET["DeviceNum"].').off()');
   }
}
elseif (isset($_GET["Button"])) { //Passing a button name to exectute that button
   hhapi('controller.buttonWithName("'.$_GET["Button"].'").activate()');
}
elseif (isset($_GET["Temp"])) { //Passing a button name to exectute that button    
   hhapi('controller.thermostatWithNumber('.$_GET["Thermostat"].').setCoolSetpoint('.$_GET["Temp"].')');
 echo("Yay for Me!");
}
    
    
 
 
function hhapi($cmd) {
        $ch = curl_init();
 
        curl_setopt($ch, CURLOPT_URL, HHAPI_URL);
        curl_setopt($ch, CURLOPT_USERPWD, HHAPI_USER . ':' . HHAPI_PASS);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $cmd);
 
        $result = curl_exec($ch);
        $error = curl_error($ch);
 
        curl_close($ch);
 
        if($error) echo $error;
 
        return json_decode($result);
}
?>