<?php require_once 'init.php'; loadScripts(); $data = array("status" => "not set!"); if (Utils::isGET()) { $pm = new ProductManager(); $rows = $pm->loadProducts(); echo json_encode($rows); return; } else { $data = array("status" => "error", "msg" => "Only GET allowed."); } echo json_encode($data, JSON_FORCE_OBJECT);