if (!is_null($devices) && is_array($devices) && !empty($devices)) { if (!is_null($title)) { printMessageWithBorder($title); } foreach ($devices as $device) { printWSBasicInfo($device); } } } //App client configuration $scope = NAScopes::SCOPE_READ_STATION; $config = array("client_id" => $client_id, "client_secret" => $client_secret, "username" => $test_username, "password" => $test_password); $client = new NAWSApiClient($config); //Authentication with Netatmo server (OAuth2) try { $tokens = $client->getAccessToken(); } catch (NAClientException $ex) { handleError("An error happened while trying to retrieve your tokens: " . $ex->getMessage() . "\n", TRUE); } //Retrieve user's Weather Stations Information try { //retrieve all stations belonging to the user, and also his favorite ones $data = $client->getData(NULL, TRUE); printMessageWithBorder("Weather Stations Basic Information"); } catch (NAClientException $ex) { handleError("An error occured while retrieving data: " . $ex->getMessage() . "\n", TRUE); } if (empty($data['devices'])) { echo 'No devices affiliated to user'; } else { $users = array();