здесь мой контроллер сервера остальныхвызова остальных сервера CodeIgniter с помощью file_get_contents
<?php
require(APPPATH.'libraries/REST_Controller.php');
class Server extends REST_Controller {
public function __construct(){
parent::__construct();
date_default_timezone_set("Asia/Jakarta");
$this->load->model('server_model');
}
function customer_get()
{
if($this->get('id')){
$users = $this->server_model->get_customer_by_id($this->get('id'));
}else{
$users = $this->server_model->get_customer_all();
}
if($users){
$this->response($users);
}else{
$this->response(array('error' => 'Data tidak ditemukan!'));
}
}
public function customer_post()
{
$data = array(
'ktm'=>$this->post('ktm'),
'ktm_image'=>$this->post('ktm_image'),
'expired_ktm'=>$this->post('expired_ktm'),
'sim'=>$this->post('sim'),
'hp'=>$this->post('hp'),
'email'=>$this->post('email'),
'password'=>md5($this->post('password')),
'fakultas'=>$this->post('fakultas'),
'jurusan'=>$this->post('jurusan'),
'alamat'=>$this->post('alamat'),
'tanggal_lahir'=>$this->post('tanggal_lahir')
);
$query = $this->server_model->create_customer($data);
if($query){
$this->response($query);
}else{
$this->response(array('error' => 'Tambah data gagal!'));
}
}
public function customer_put()
{
$id = $this->put('id');
$data = array(
'ktm'=>$this->put('ktm'),
'ktm_image'=>$this->put('ktm_image'),
'expired_ktm'=>$this->put('expired_ktm'),
'sim'=>$this->put('sim'),
'hp'=>$this->put('hp'),
'email'=>$this->put('email'),
//'password'=>$this->put('password'),
'fakultas'=>$this->put('fakultas'),
'jurusan'=>$this->put('jurusan'),
'alamat'=>$this->put('alamat'),
'tanggal_lahir'=>$this->put('tanggal_lahir')
);
$query=$this->server_model->update_customer($data,$id);
if($query){
$this->response($query);
}else{
$this->response(array('error' => 'Edit data gagal!'));
}
}
public function customer_delete(){
$id = $this->delete('id');
$query = $this->server_model->delete_customer($id);
if($query){
$this->response($query);
}else{
$this->response(array('error' => 'Hapus data gagal!'), 404);
}
}
}
как вызвать каждый метод в серверном отдыхе, как получить, после, говоря, удалять и передавать данные от клиента, но использовать file_get_contents. Я использую codeigniter библиотеки сервера поколений.
Я попробовал использовать клиентскую библиотеку отдыха в codeigniter, и он полностью работает, но теперь мне нужно использовать file_get_contents, но я не знаю, как его назвать, особенно для отправки данных для публикации, отправки и удаления ,
спасибо.