在RESTful Web服务中POST

时间:2015-12-16 21:35:19

标签: web-services rest jersey

我正在尝试使用Jersy或Restlet学习RESTful Web服务中的基本CURD操作。

任何人都可以向我提供一些示例,说明如何将单词/消息从一个Web应用程序发布到另一个Web应用程序(即),从第一个应用程序发布消息,然后在第二个应用程序中实现GET以接收它。

谢谢,

1 个答案:

答案 0 :(得分:0)

它可能对你的codeigniter发布网络服务演示有用吗

public function add_category() {
    ###############  post parameter #######

    $user_id = $this->is_require($_POST, 'user_id');
    $user_token = $this->is_require($_POST, 'user_token');
    $cat_name = $this->is_require($_POST, 'cat_name');
    $parent_id = $this->is_require($_POST, 'parent_id');
    $this->Is_authorised($user_id, $user_token, 1);
    #######################################
    $q = "select * from tbl_category where cat_name='$cat_name' and parent_id ='$parent_id' limit 1";
    $c_exits = $this->basic->select_custom($q);
    if (!empty($c_exits)) {
        $this->msg = "category already exist";
        $this->_sendResponse(2);
    }

    $inn = array(
        'cat_name' => $cat_name,
        'parent_id' => $parent_id,
    );

    $temp = $this->basic->insert_entry("tbl_category", $inn, TRUE);
    if ($temp['stat'] == 1) {
        $this->result['cat_id'] = $temp['last_id'];
    } else {
        $this->_sendResponse(0);
    }
    $this->_sendResponse(1);
}
相关问题