Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Code 500 #160

Open
GerritRie opened this issue Mar 12, 2021 · 0 comments
Open

Code 500 #160

GerritRie opened this issue Mar 12, 2021 · 0 comments

Comments

@GerritRie
Copy link

GerritRie commented Mar 12, 2021

Hello guys i have a problem using the PHP_Client.
On my Xampp Local Machine (Windows 10) everthing works great. But if i put the exact same files on my Linux VPS the Server gives me a 500 Code:

Can someone maybe help me ?

Here ist my Code:

<?php

require __DIR__ . '\..\vendor\autoload.php';


use InfluxDB2\Client;
use InfluxDB2\Model\WritePrecision;
use InfluxDB2\Point;
echo getdata("Jürgen ", "M_AC_Power");
function getdata($kunde,$wert)
{
# You can generate a Token from the "Tokens Tab" in the UI
    $token = '';
    $org = 'JH';
    $bucket = 'PV-Daten';
    $client = new Client([
        "url" => "http://95.111.224.215:8086",
        "token" => $token,
    ]);


    $query = '

from(bucket: "PV-Daten")
  |> range(start: -5s)
  |> filter(fn: (r) => r["name"] == "'.$kunde.'")
  |> filter(fn: (r) => r["_field"] == "'.$wert.'")
  |> last()

  ';

    $tables = $client->createQueryApi()->query($query, $org);


    if (isset($tables[0])) {
        $data = ($tables[0]);
        $data = $data->records;
        $data = ($data[0]);

        return ($data->getValue());
    } else {
        return ("fail");
    }

}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant