How can i catch the Json response in this catch php function
There a long script set as rest api and it have at the end the catch to get the either a success json or the error
try {// echo json_encode(array('errMsg' => 'Server is under maintainance, will get back in few minutes..!', 'errNum' => 999, 'errFlag' => 1));// return false; $API = new MyAPI($_SERVER['REQUEST_URI'], $_REQUEST, $_SERVER['HTTP_ORIGIN']); echo $API->processAPI();} catch (Exception $e) { echo json_encode(Array('error' => $e->getMessage()));}
I am trying to echoing or emailing using mail the response that appears to me echo $API->process(); however it shows nothing but the error is correctly displayed and emailed once the error is the case, i have attached the fill script without the mail function so the pros can help me to do it as best practise, all my need is to get the response shown or emailed for me for debugging rest.php