Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8161469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:30:23+00:00 2026-06-06T18:30:23+00:00

Its my first time to use web service in iOS. REST was my first

  • 0

Its my first time to use web service in iOS.
REST was my first choice and I use code igniter to form it.

I have my Controller:

require APPPATH.'/libraries/REST_Controller.php';

class Sample extends REST_Controller
{

    function example_get()
    {
        $this->load->helper('arh');
        $this->load->model('users');

        $users_array = array();
        $users = $this->users->get_all_users();

        foreach($users as $user){
            $new_array = array( 
                                'id'=>$user->id , 
                                'name'=>$user->name,
                                'age'=>$user->age,
                              );
            array_push( $users_array, $new_array);
        }

        $data['users'] = $users_array;      
        if($data)
        {
            $this->response($data, 200);
        }
    }

    function user_put()
    {  
        $this->load->model('users');
        $this->users->insertAUser();

        $message = array('message' => 'ADDED!');
        $this->response($message, 200);

    } 

}

, using my web browser, accessing the URL http://localhost:8888/restApi/index.php/sample/example/format/json really works fine and gives this output:

{"users":[{"id":"1","name":"Porcopio","age":"99"},{"id":"2","name":"Name1","age":"24"},{"id":"3","name":"Porcopio","age":"99"},{"id":"4","name":"Porcopio","age":"99"},{"id":"5","name":"Luna","age":"99"}]}

, this gives me a great output using RKRequest by RestKit in my app.

The problem goes with the put method. This URL :

http://localhost:8888/restApi/index.php/sample/user

always give me an error like this:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<xml>
<status/>
<error>Unknown method.</error>

This is my Users model

<?php

    class Users extends CI_Model {
        function __construct()
        {
            parent::__construct();
        }

        function get_all_users()
        {
            $this->load->database();
            $query = $this->db->get('users');
            return $query->result();
        }

        function insertAUser(){
            $this->load->database();
            $data = array('name'=> "Sample Name", 'age'=>"99");
            $this->db->insert('users', $data);
        }
    }
?>

What is the work around for my _put method why am I not inserting anything?
Thanks all!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:30:24+00:00Added an answer on June 6, 2026 at 6:30 pm

    I got this problem by using Firefox plug in rest Client.
    I just have to indicate the headers and the body to make put and post work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It's the first time I use a web service with SOAP in a php
I have some problem with this mongoid. It's my first time to use mongoDB,
I have an app, in that app if its the first time the user
I have just created my first rest service using apicontroller. I am using it
I have a web service deployed and ready to use. The client application is
It's the first time I have done anything like this but wondered what the
I have a web site and build a wcf service in it. I can
I'm trying to use PHP to authenticate to a web service by posting to
I'm looking to build my first web service and I would like to be
My app is architected as follows: I have a web service (running on GAE,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.