Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14343

Building API via Codeigniter

$
0
0
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();

Viewing all articles
Browse latest Browse all 14343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>