Figure 3: Constructing the REST URL, part 1


<?php
/* *****************************
 * Model:  connect
 *******************************/
function model_connect()
{ global $MODEL, $RESTSERVER;
  $service = "http://$.$SERVER["SERVER_NAME"];
  if (isset($_SERVER["SERVER_PORT"]))
  { $service .= ":".$_SERVER["SERVER_PORT"];
  }
  $service .= $RESTSERVER;
  $MODEL ['conn'] = $service;
  return True;
}
function model_error_rest($error = '')
{ model_error($error);
}
?>