Accessing latest data via PHP

I’m trying to create a PHP script to obtain and send the latest PHPfina data and send it via CURL to a separate server. I’ve found PHPfina.php in pi/usefulscripts/convertdata/Lib and see there is a ‘lastvalue’ function - but I’m having trouble getting it to work. My code is:


$finaFeed = 1;
$PHPFina = new PHPFina;
$lastData = $PHPFina->lastvalue($finaFeed);
$timestamp = $lastData['time'];
$data = $lastData['value'];

…but I’m getting:

PHP Warning: Missing argument 1 for PHPFina::__construct(), called in /home/send_data_to_blockchain.php on line 15 and defined in /home/pi/usefulscripts/convertdata/Lib/PHPFina.php on line 23
PHP Fatal error: Class ‘EmonLogger’ not found in /home/pi/usefulscripts/convertdata/Lib/PHPFina.php on line 27

Am I missing another include? Or is there a better way of accessing the PHPfina data?


Actually it looks like its easier to just use the emoncms API!