function likePost()
{
    $rm = new Response_Methods();
    if ($_SERVER['REQUEST_METHOD'] == "GET") {
        $result = $rm->inValidServerMethod();
        return $result;
    }
    //Check request url is https or not
    if (!empty($_SERVER["HTTPS"])) {
        if ($_SERVER["HTTPS"] !== "off") {
            $USERID = trim($_POST['userId']);
            //Get Request From Device
            $POSTID = trim($_POST['postId']);
            //Get Request From Device
            $getArrayList = array();
            if ($USERID == "" || $POSTID == "") {
                $result = $rm->fields_validation();
                return $result;
            } else {
                $checkLike = $rm->checkAlreadyLiked($USERID, $POSTID);
                if ($checkLike > 0) {
                    $result = $rm->alreadyLiked();
                    return $result;
                }
                date_default_timezone_set('Asia/Calcutta');
                $user_owner_id = $rm->idToValue('user_id_fk', 'news_feeds_t', 'post_id', $POSTID);
                //getting user owner id
                $createdDate = date('Y-m-d H:i:s');
                $getInsertFieldValue['user_id_fk'] = $USERID;
                $getInsertFieldValue['post_id_fk'] = $POSTID;
                $getInsertFieldValue['user_owner_id_fk'] = $user_owner_id;
                $getInsertFieldValue['likeDate_f'] = $createdDate;
                $lastInserted_user_id = $rm->insert_record($getInsertFieldValue, 'likes_t');
                if (!empty($lastInserted_user_id)) {
                    $sqlLikeCountUpdate = "update news_feeds_t set like_count_f= like_count_f+1 where post_id={$POSTID}";
                    mysql_query($sqlLikeCountUpdate, $GLOBALS['link']);
                    $deviceId = $rm->idToValue('device_id_f', 'user_details_t', 'user_id', $user_owner_id);
                    //getting deviceId
                    if ($deviceId != '') {
                        $message = "You have received a like on your post.";
                        $rm->sendPushNotification($deviceId, $message);
                    }
                    $result = $rm->getParticularPost($POSTID, $USERID);
                    return $result;
                } else {
                    $result = $rm->likeUnSuccessful();
                    return $result;
                }
            }
            // end of else first
        } else {
            $result = $rm->ssl_error();
            return $result;
        }
    } else {
        $result = $rm->ssl_error();
        return $result;
    }
}
 function getParticularPost($postId, $userId)
 {
     $sqlFetchPosts = "SELECT U.user_name_f, U.profile_pic_f, N.post_id, N.post_description_f, N.post_date_f,N.user_id_fk,N.post_image_f, N.like_count_f\nFROM user_details_t U, news_feeds_t N\nWHERE \nN.user_id_fk = U.user_id\nAND \nN.post_id={$postId}";
     $dataResultSet = mysql_query($sqlFetchPosts, $GLOBALS['link']);
     $rm = new Response_Methods();
     $getGrpDetails = array();
     $getArrayList = array();
     if (mysql_num_rows($dataResultSet) > 0) {
         while ($row = mysql_fetch_array($dataResultSet)) {
             $post_id = $row['post_id'];
             $post_description = $row['post_description_f'];
             $post_image = $row['post_image_f'];
             $like_count = $row['like_count_f'];
             $post_date = $row['post_date_f'];
             $post_user_id = $row['user_id_fk'];
             $user_name = $row['user_name_f'];
             $profilePic = $row['profile_pic_f'];
             $checkLike = $rm->checkAlreadyLiked($userId, $post_id);
             if ($checkLike > 0) {
                 $like_status = "1";
             } else {
                 $like_status = "0";
             }
             $getGrpDetails['post_id'] = $post_id;
             $getGrpDetails['post_description'] = $post_description;
             $getGrpDetails['post_image_url'] = $post_image;
             $getGrpDetails['like_count'] = $like_count;
             $getGrpDetails['like_status'] = $like_status;
             $getGrpDetails['post_date'] = $post_date;
             $getGrpDetails['user_name'] = $user_name;
             //username posted
             $getGrpDetails['post_user_id'] = $post_user_id;
             //userid posted newsfeed
             $getGrpDetails['profilePic'] = $profilePic;
             //$getGrpDetails['profileId']=$profile_id;
             /*
             $followArray=$rm->followerFollowingCount($userid);
             //print_r($followArray);
             $getGrpDetails['followersCount']=$followArray['followers'];	
             $getGrpDetails['followingCount']=$followArray['following'];	
             */
             array_push($getArrayList, $getGrpDetails);
         }
         //print_r($getArrayList);
         $newData = json_encode($getArrayList);
         $newData = str_replace('\\/', '/', $newData);
         $newData = substr($newData, 1, strlen($newData) - 2);
         $newData = "{\"data\":{\"Error_Code\":\"2\",\"Error_Msg\":\"Like Done Successfully\",\"result\":" . $newData . "}}";
         return $newData;
     } else {
         $errorCode = "0";
         $errorMsg = "No Newsfeeds Available";
         $newData = "{\"data\":{\"Error_Code\":\"" . $errorCode . "\",\"Error_Msg\":\"" . $errorMsg . "\"}}";
         //Json Format Response
         return $newData;
         //Login Unsuccessful
     }
 }