SyferLock Help Center

GridGuard REST API - Sample PHP Code

This article simply provides a sample framework for a php function that can be used to invoke the API. Please refer to the GridGuard™ REST API documentation for specifics on API method calls.


  • $authUser & $authPassword are the user id and password for a user who belongs to the Administrators group for the realm.
  • $password & $corner are the new password and corner values for the user with user id = $userid
  • is assumed to be the name of the GridGuard™ server

Function to update user's PIN/Password and Corner

function updateGridPass($authUser, $authPassword, $realm, $userid, $password, $corner) {
  $xmlData =  '<action>' .
        ' <param name="userid" value="{userid}"/>' .
        ' <param name="appid" value="{appid}"/>' .
        ' <param name="password" value="{password}"/>' .
        ' <param name="corner" value="{corner}"/>' .
  $xmlData = str_replace("{userid}", $userid, $xmlData);
  $xmlData = str_replace("{appid}", $realm, $xmlData);
  $xmlData = str_replace("{password}", $password, $xmlData);
  $xmlData = str_replace("{corner}", $corner, $xmlData);
  $URL = "" . $realm;
  $ch = curl_init($URL);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_USERPWD, "$authUser:$authPassword");
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml'));
  curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlData);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $output = curl_exec($ch);
  $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  echo "http return code = $httpCode";
  echo "result = $output";
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Powered by Zendesk