*/
public $password;
+ /**
+ * Logging verbosity
+ * 0 - no debug logging
+ * 1 - show important details (connected URLs)
+ * 2 - show internal details
+ *
+ * @var integer
+ */
+ public $verbosity = 0;
+
/**
*/
public function reboot()
{
+ $url = $this->getAuthBaseUrl() . '/apply.cgi';
+ $this->log('Connecting to ' . $url);
+
$r = new HTTP_Request2();
$r->setMethod(HTTP_Request2::METHOD_POST);
- $r->setUrl(
- $this->getAuthBaseUrl() . '/apply.cgi'
- );
+ $r->setUrl($url);
$r->addPostParameter('action', 'Reboot');
$r->addPostParameter('submit_button', 'Diagnostics');
$r->addPostParameter('wait_time', 1);
$r = new HTTP_Request2();
$r->setMethod(HTTP_Request2::METHOD_GET);
$r->setUrl($strUrlBase . '/index_wstatus2.asp');
+ $this->log('Connecting to ' . $strUrlBase . '/index_wstatus2.asp', 1);
$resp = $r->send();
- echo $resp->getStatus() . ' ' . $resp->getReasonPhrase() . "\n";
+ $this->log($resp->getStatus() . ' ' . $resp->getReasonPhrase(), 1);
$arRetval = $parser->index_wstatus2($resp->getBody());
/**
* GPRS/UMTS Status
*/
$r->setUrl($strUrlBase . '/index_wstatus1.asp');
+ $this->log('Connecting to ' . $strUrlBase . '/index_wstatus1.asp', 1);
$resp = $r->send();
$body = $resp->getBody();
$arRetval = array_merge($arRetval, $parser->index_wstatus1($body));
return $arRetval;
}//public function getStatus()
+
+
+
+ /**
+ * Log a message to stdout.
+ *
+ * @param string $msg Message to display
+ * @param integer $level Log level, see $verbosity
+ *
+ * @return void
+ */
+ protected function log($msg, $level = 1)
+ {
+ if ($this->verbosity >= $level) {
+ echo $msg . "\n";
+ }
+ }
}
?>
\ No newline at end of file