changing api.php to support json format, api2.php to try messaging