1. Go to this page and download the library: Download markmorgan/octopus-energy library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
markmorgan / octopus-energy example snippets
$apiKey = 'my-octopus-apikey';
$client = new \OctopusEnergy\Client($apiKey);
$mpan = 'YOUR MPAN NUMBER';
$serialNumber = 'YOUR METER SERIAL NUMBER';
$consumptionSearch = $client->meters->getElectricityMeterConsumption(
$mpan,
$serialNumber
);
$fromDate = new \DateTime();
$fromDate->setTimestamp(1640995201); // Jan 1st 2022
$toDate = new \DateTime();
$toDate->setTimestamp(1643673601); // Feb 1st 2022
$pageNumber = 1;
$consumptionSearch = $client->meters->getElectricityMeterConsumption(
$mpan,
$serialNumber,
$pageNumber,
$fromDate,
$toDate
);
// fetch all grid supply point info
$gspSearch = $client->industry->getGridSupplyPoints();
// fetch grid supply point info for a postcode
$postcode = 'cf104uw';
$gspSearch = $client->industry->getGridSupplyPoints($postcode);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.