Having trouble with $_GET variables |
[eluser]rebellion[/eluser]
I read this explanation on how to get $_GET variables accessible for my method, but it won't work. I've tried all the available URI protocols in the config.php. The thing is; I'm using an SMS service that allows users to send a text message to a number. The service will then send the SMS content as GET variables to an URL. I could write a script that process the incoming data, but it involves a bit of database handling and checks, and should then simply echo out "OK". I want to be able to do this with an SMS controller, instead of a non-CI script. The controller/method URL looks like this: http://mydomain.com/sms/receive_sms/ The SMS service sends the variables as follows: http://mydomain.com/sms/receive_sms/?msg...&message=x But those variables are unaccessible for me, even though I followed this guide: http://ellislab.com/forums/viewthread/99570/
[eluser]rebellion[/eluser]
Quote:I’ve tried all the available URI protocols in the config.php. Yep ![]()
[eluser]daparky[/eluser]
http://ellislab.com/forums/viewthread/56389/#277621
[eluser]Tandubhai[/eluser]
You can do in this way with your own custom uri helper: function uri_assoc($var, $segment = 3) { $CI =& get_instance(); $uri_assoc = $CI->uri->uri_to_assoc($segment); if (isset($uri_assoc[$var])) { return $uri_assoc[$var]; } else { return NULL; } } $this->load->helper('uri'); uri_assoc('msgid',2); uri_assoc('number',2); uri_assoc('message',2); |
Welcome Guest, Not a member yet? Register Sign In |