Welcome Guest, Not a member yet? Register   Sign In
HTTP GET - parsing query params using code igniter
#1

[eluser]contact_kram[/eluser]
I would like codeigniter to parse a HTTP GET request with one or more parameters. For example, http://my-devhost/classname/methodname?abc=123

I now get a 404 error when I attempt to do that. From reading a few documents online, I believe that GET is not enabled in codeigniter. Any one here has any experience in parsing HTTP GET arguments in codeigniter?

Thank you, -k
#2

[eluser]ciGR[/eluser]
You must use the
Code:
http://my-devhost/classname/methodname/123

and in your controller your method will be
Code:
function methodname($abc = '')
{
echo 'abc -> ' . $abc;
}
#3

[eluser]contact_kram[/eluser]
Unfortunately that will not work for me. To provide more details, I am writing a web application to download pictures from Flickr. Flickr will redirect my initial authentication request to my callback URI with a parameter appended to the my callback URI.

So, if my callback URI was http://my-devhost/classname/methodname, flickr will append abc=123 argument to the callback URI. Essentially, I do not have any control over the URI generation.

I have this working in my non-codeigniter framework. But I would love to port the code over to codeigniter. I am sure this is solvable but being new to codeigniter, I am not sure how.

Thank you,
-k
#4

[eluser]ciGR[/eluser]
You can see here http://ellislab.com/codeigniter/user-gui.../urls.html about Enabling Query Strings
or you may can do something with extending the Router library.
If I find something, I 'll post it, but now its time(3.30a.m.here) to sleep.
#5

[eluser]ciGR[/eluser]
Hi,
try go to config file and change the
Code:
$config['uri_protocol']    = "AUTO";
with
Code:
$config['uri_protocol'] = "PATH_INFO";

and also set
Code:
$config['enable_query_strings'] = TRUE;

and now if for example
have the url
Code:
site/controller_name/method/arg1/arg2?abc=fdfd

you can use in your controller the
Code:
$_GET['abc']
to get the abc value




Theme © iAndrew 2016 - Forum software by © MyBB