protected function _post_data() { if (!$this->options['secret.key']) { throw CametricsException('No Secret Key Specified. Use ' . get_class(self) . '::initialize'); } $uri = Cametrics::getURL(); syslog(LOG_NOTICE, sprintf('Cametrics posting: %s', $uri)); $this->browser->post($uri, array('type' => 'bulk', 'data' => json_encode($this->data), 'format' => $this->options['response.format'])); $this->data = array(); $message = sprintf('Cametrics post of: %s, returned (%s): %s', $uri, $this->browser->getResponseCode(), $this->browser->getResponseText()); switch ($this->browser->getResponseCode()) { case 200: syslog(LOG_INFO, $message); return true; default: # .. syslog(LOG_ERR, $message); return false; } }
<?php require_once dirname(__FILE__) . '/fixtures/cametrics.helper.php'; assert(is_array(Cametrics::getOptions())); assert(Cametrics::getSecretKey() != ''); assert(Cametrics::getURL() == 'http://localhost/measure/' . Cametrics::getSecretKey() . '/');