/** * Returns data as a result of API call. * * @param mixed $result Result. */ public static function sendData($result) { // Encodes result to UTF8. Nl2goManager::utf8Encode($result); // Create ok response. $response = array('status' => 'ok', 'data' => $result); // Return result in json form. echo json_encode($response); // Stop rendering contact form. exit; }