lib/ThreeScaleClient.php
public function report($transactions, $credentials_or_service_id) {
    if (empty($transactions)) {
      throw new InvalidArgumentException('no transactions to report');
    }
    
    $url = $this->getHost() . "/transactions.xml";

    $params = array();

    if ($credentials_or_service_id instanceof ThreeScaleClientCredentials ) {

      $params['service_token'] = $credentials_or_service_id->service_token;
      $params['service_id'] = $credentials_or_service_id->service_id;
    } else {
      $params['provider_key'] = $this->getProviderKey();
      $params['service_id'] = $credentials_or_service_id;
    }

    $params['transactions'] = $this->encodeTransactions($transactions);
    
    $httpResponse = $this->httpClient->post($url, $params);
    
    if (self::isHttpSuccess($httpResponse)) {
      return new ThreeScaleResponse(true);
    } else {
      return $this->processError($httpResponse);
    }
  }
public function report($transactions, $credentials_or_service_id) {
    if (empty($transactions)) {
      throw new InvalidArgumentException('no transactions to report');
    }
    
    $url = $this->getHost() . "/transactions.xml";

    $params = array();

    if ($credentials_or_service_id instanceof ThreeScaleClientCredentials ) {

      $params['service_token'] = $credentials_or_service_id->service_token;
      $params['service_id'] = $credentials_or_service_id->service_id;
    } else {
      $params['provider_key'] = $this->getProviderKey();
      $params['service_id'] = $credentials_or_service_id;
    }

    $params['transactions'] = $this->encodeTransactions($transactions);
    
    $httpResponse = $this->httpClient->post($url, $params);
    
    if (self::isHttpSuccess($httpResponse)) {
      return new ThreeScaleResponse(true);
    } else {
      return $this->processError($httpResponse);
    }
  }
Report transaction(s).

@param $transactions array of transactions to report.

Each transaction is an array with these elements:

"app_id"    - ID of the application to report the transaction for.
This parameter is required.

"usage"     - Array of usage values. The keys are metric names and values
are correspoding numeric values.
Example: array('hits' => 1, 'transfer' => 1024).
This parameter is required.

"timestamp" - Timestamp of the transaction. This can be either an integer
(the unix timestamp) or a string in the "YYYY-MM-DD HH:MM:SS"
format (if the time is in the UTC), or a string in the
"YYYY-MM-DD HH:MM:SS ZZZZZZ" format, where the ZZZZZZ is the time
offset from the UTC. For example, "US Pacific Time" has offset -08:00,
"Tokyo" has offset +09:00. This parameter is optional, and if not
provided, equals to the current time.

@return ThreeScaleResponse

The response object's isSuccess() method returns true if the report was successful,
or false if there was an error. See @see ThreeScaleResponse class for more information.

@throws ThreeScaleServerError in case of unexpected internal server error.

Example:

<code>
<?php
// Report two transactions of two applications with app_id
$client->report(array(array('app_id' => 'foo', 'usage' => array('hits' => 1)),
array('app_id' => 'bar', 'usage' => array('hits' => 1)), 'service id');

// Report one transaction with timestamp with app_id
$client->report(array(array('app_id'    => 'foo',
'timestamp' => mktime(15, 14, 00, 2, 27, 2010),
'usage'     => array('hits' => 1),
'service id')));

// Report two transactions of two applications with user_key
$client->report(array(array('user_key' => 'foo', 'usage' => array('hits' => 1)),
array('user_key' => 'bar', 'usage' => array('hits' => 1)), 'service id'));

// Report one transaction with timestamp and with user_key
$client->report(array(array('user_key'    => 'foo',
'timestamp' => mktime(15, 14, 00, 2, 27, 2010),
'usage'     => array('hits' => 1),
'service id')));

?>
</code>