$itm->created_at = $created_at; $itm->email = $email; $itm->name = $name; $itm->sms = $sms; $itm->updated_at = $updated_at; $itm->zipcode = $zipcode; $itm->photo_url = $photo_url; $itm->thumb_url = $thumb_url; $itm->twitter = $twitter; $itm->fb = $fb; $itm->linkedin = $linkedin; $itm->company = $company; $itm->user_id = $user_id; if ($agent != null) { $itm->agent_id = $agent->agent_id; $controllerRestAgent->updateAgent($itm); } else { $controllerRestAgent->insertAgent($itm); } $itm = $controllerRestAgent->getAgentByUserId($user_id); $json = "{\n \"agent_info\" : {\n \"address\" : \"{$itm->address}\",\n \"agent_id\" : \"{$itm->agent_id}\",\n \"contact_no\" : \"{$itm->contact_no}\",\n \"country\" : \"{$itm->country}\",\n \"created_at\" : \"{$itm->created_at}\",\n \"email\" : \"{$itm->email}\",\n \"name\" : \"{$itm->name}\",\n \"sms\" : \"{$itm->sms}\",\n \"updated_at\" : \"{$itm->updated_at}\",\n \"zipcode\" : \"{$itm->zipcode}\",\n \"photo_url\" : \"{$itm->photo_url}\",\n \"thumb_url\" : \"{$itm->thumb_url}\",\n \"twitter\" : \"{$itm->twitter}\",\n \"fb\" : \"{$itm->fb}\",\n \"linkedin\" : \"{$itm->linkedin}\",\n \"company\" : \"{$itm->company}\",\n \"user_id\" : \"{$user->user_id}\",\n },\n\n \"status\" : {\n \"status_code\" : \"-1\",\n \"status_text\" : \"Success.\"\n }\n }"; } else { $json = "{\n \"status\" : {\n \"status_code\" : \"5\",\n \"status_text\" : \"It seems you are out of sync. Please relogin again.\"\n }\n }"; } } else { $json = "{\n \"status\" : {\n \"status_code\" : \"5\",\n \"status_text\" : \"It seems you are out of sync. Please relogin again.\"\n }\n }"; } } else { $json = "{\n \"status\" : {\n \"status_code\" : \"3\",\n \"status_text\" : \"Invalid Access.\"\n }\n }"; } echo $json;