1

PHP execute report

Тема: PHP execute report

Hello everyone, I have a problem because I try to run a report using PHP code but it gives me "error 4" and I don't understand why if I can guide myself with the SDK documentation to do so.

I hope you can tell me what I'm wrong, thanks a lot

CODE
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php

    include('wialon.php');
    $wialon_api = new Wialon();


    $token = '43517c82b599a4153ffe18e8c9a20a00F7EC3DE7A022FCA49327AD3D6E38B75F2E1DDD8C';
    $result = $wialon_api->login($token);
    $json = json_decode($result, true);
    if(!isset($json['error'])){
        $params = array(
                    'spec' => array(
                        'reportResourceId' => 19554996,
                        'reportTemplateId' => 1,
                        'reportObjectId' => 16595473,
                        'reportObjectSecId' => 0,
                         'interval' => array(
                            'from' => 1561957200,
                            'to' => 1564635600,
                            'flags' => 1
                         )
                         

                       
                    )
                );
       
               
               
                echo $wialon_api->report_exec_report(json_encode($params));
        $wialon_api->logout();
    } else {
        echo WialonError::error($json['error']);
    }

        ?>
    </body>
</html>

2

PHP execute report

Re: PHP execute report

Hello

please try to set parameter   'flags'  to 0 value,  value 1 means: starts 'From' until today. But as you define 'from' and 'to' time, you need to use flags value: specified interval

Diana Cheley
Wialon Hosting Expert
Gurtam