New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

acte/data-report-sdk

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acte/data-report-sdk

Connect to ACTE Technology data reporting API

Source
Packagist
Version
dev-master
Version published
Total downloads
2
Maintainers
3
Created
Source

Data Reporting PHP SDK

  • Collect your data via ACTE Technology secured gateway

Installation

Install with composer:

composer require acte/data-report-sdk

Configuration

  • Contact ACTE support in order to receive username, password and authorized databases
  • copy below code and edit configuration variables

Example

<?php
use ReportSdk\Connector;

// Configuration variables
$base_url = "https://example.com";
$username = "YOUR_USERNAME";
$password = "YOUR_PASSWORD";
$db = "DATA_DB"; # database

// init api class and connect
$api = new Connector($base_url);
$api->connect($username, $password);

// Check if the connection is successful
if ($api->check_connection()) {
    echo "Connected successfully.\n";
}

// get allowed databases
$databases = $api->getDatabases();
print_r($databases);
$db = $databases[0];

// get devices
$devices = $api->getDevices($db);
print_r($devices);
$device = $devices[0];

// get keys from device
$keys = $api->getKeys($db, $device);
print_r($keys);
$key = $keys[0];


// get telemetry data
//  prepare configuration parameters
date_default_timezone_set('UTC'); // Set the timezone to UTC
$to_ts = strtotime(date("Y-m-d", time()));
$from_ts = strtotime(date("Y-m-d", strtotime("-7 days")));

// TO DO:::
// $agg_type = "SUM"; // aggregation method: AVG | MIN | MAX | SUM
// $agg_interval = 3600; // aggregation interval in seconds

$data = $api->getTelemetry($db, $device, $key, $from_ts, $to_ts);
print_r($data);

Keywords

data

FAQs

Package last updated on 08 Jun 2024

Related posts