Welcome Guest, Not a member yet? Register   Sign In
Building API via Codeigniter
#1

Hi guys!

I build API, and I need that access url was like:
http://api.site.local/controller.method[.xml|.json]?param1=value1&param2=value2
([.xml|.json] - optional, json will be default)

I set next options in my config.php:
$config['enable_query_strings'] = TRUE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

and add rewrite rule to .htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z]+)\.([a-z]+)(\.(xml|json))?$ index.php?c=$1&m=$2&format=$4 [NC]

How can i get input parameters via default method $this->input->get();
Reply




Theme © iAndrew 2016 - Forum software by © MyBB