CodeIgniter Forums
HTTP GET - parsing query params using code igniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: HTTP GET - parsing query params using code igniter (/showthread.php?tid=28034)



HTTP GET - parsing query params using code igniter - El Forum - 02-27-2010

[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


HTTP GET - parsing query params using code igniter - El Forum - 02-27-2010

[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;
}



HTTP GET - parsing query params using code igniter - El Forum - 02-27-2010

[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


HTTP GET - parsing query params using code igniter - El Forum - 02-27-2010

[eluser]ciGR[/eluser]
You can see here http://ellislab.com/codeigniter/user-guide/general/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.


HTTP GET - parsing query params using code igniter - El Forum - 03-01-2010

[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