0

I'm trying to build a Restful API using CI Rest Server (available here : https://github.com/chriskacerguis/codeigniter-restserver)

I downloaded the repository and put the two files : Format.php and REST_Controller.php in my app's libraries folder and the rest.php file in the config folder.

Here is my API controller content :

<?php 

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


 class Api extends REST_Controller {

function __construct()
{
    parent::__construct();
    $this->load->database();
    $this->load->model("doseapim");
}

function getDose(){
    if(!$this->get('isid'))
    {
        $this->response(NULL, 400);
    }

    $user = $this->doseapim->getdose($this->get('isid') );

    if($user)
    {
        $this->response($user, 200); // 200 being the HTTP response code
    }

    else
    {
        $this->response(NULL, 404);
    }
 }

}

However, I'm getting this error :

A PHP Error was encountered

Severity: Parsing Error

Message: syntax error, unexpected ''.libraries/REST_Controller.ph' (T_CONSTANT_ENCAPSED_STRING)

Filename: controllers/Api.php

Line Number: 4

Backtrace:

Is there anyone who can help me to solve this issue,

Thanks in advance

(I'm using PHP 5.6)

1 Answer 1

4

Replace below line

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

With:

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your answer Jay ! I think the problem is solved partially as I'm now getting this error : Unable to load the requested language file: language/english/rest_controller_lang.php
I just solved it by putting the rest_controller_lang.php file from the repository to my app's directory. Thanks a lot !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.