Hi guyz! I have been using slim for Rest api. Its post method is working fine in local host. but when i go on live server it does not send values to server. Can someone told me the solution of this problem. I have been looking for almost a week now, but can’t find any solution. Any help will be Appreciated thanks. below is my code for post method:
$app->post('/register', function() use ($app) {
// check for required params
verifyRequiredParams(array('username', 'email', 'password'));
$response = array();
// reading post params
$username = $app->request->post('username');
$email = $app->request->post('email');
$password = $app->request->post('password');
// validating email address
validateEmail($email);
$db = new DbHandler();
$res = $db->createUser($username, $email, $password);
if ($res == USER_CREATED_SUCCESSFULLY) {
$response["error"] = false;
$response["message"] = "You are successfully registered";
} else if ($res == USER_CREATE_FAILED) {
$response["error"] = true;
$response["message"] = "Oops! An error occurred while registereing";
} else if ($res == USER_ALREADY_EXISTED) {
$response["error"] = true;
$response["message"] = "Sorry, this email already existed";
}
// echo json response
echoRespnse(201, $response);
});