Find us on facebook

Jun 25, 2014

Web Service to update data in DB with Android or IOS - YII

public function actionGetGcm() {

try {

if ((isset($_POST['token'])) && !empty($_POST['token'])&&(isset($_POST['customer_id'])) && !empty($_POST['customer_id'])) {

$token = $_POST['token'];
$customer_id = $_POST['customer_id'];
$Pda = new Pda;
$Pda -> gcm_token = $token;
$Pda -> customer_id = $customer_id;
$Pda -> save();
if($Pda->save()){
$msg = CJSON::encode(array( array('success' => "success", 'message' => 'exception','pda_id'=>$Pda->id)));
echo $msg;
}else{
$msg = CJSON::encode(array( array('success' => "false", 'message' => 'exception')));
echo $msg;
}
}

} catch (Exception $exc) {
$msg = CJSON::encode(array( array('success' => "false", 'message' => 'exception')));
echo $msg;
}

}

Can test function using  http://www.hurl.it/

No comments:

Post a Comment