I'm creating an e-commerce site using CodeIgniter.
How should I get the query string?
I am using a Saferpay payment gateway. The gateway response will be like this:
http://www.test.com/registration/success/?DATA=<IDP+MSGTYPE%3D"PayConfirm"+KEYID%3D"1-0"+ID%3D"KI2WSWAn5UG3vAQv80AdAbpplvnb"+TOKEN%3D"(unused)"+VTVERIFY%3D"(obsolete)"+IP%3D" 123.25.37.43"+IPCOUNTRY%3D"IN"+AMOUNT%3D"832200"+CURRENCY%3D"CHF"+PROVIDERID%3D"90"+PROVIDERNAME%3D"Saferpay+Test+Card"+ACCOUNTID%3D"99867-94913159"+ECI%3D"2"+CCCOUNTRY%3D"XX"%2F>&SIGNATURE=bc8e253e2a8c9ee0271fc45daca05eecc43139be6e7d486f0d6f68a356865457a3afad86102a4d49cf2f6a33a8fc6513812e9bff23371432feace0580f55046c
To handle the response I need to get the query string data.
Sorry, I haven't explained the problem clearly. I am getting a 'Page not found' error while getting the response from the payment site after payment.
I have tried enabling with uri_protocol = 'PATH_INFO'
and enable_query_strings = 'TRUE'
in config.php
. While googling I found this won't work if I use htaccess rewrite.
I have already tried changing the config entries, but it doesn't work.
To submit a query, use the following function: $this->db->query('YOUR QUERY HERE'); The query() function returns a database result object when "read" type queries are run, which you can use to show your results. When "write" type queries are run it simply returns TRUE or FALSE depending on success or failure.
A query string is a term for adding/passing data in the URL. It is not language specific.
CodeIgniter Query String Example: This article shows you how to enable query string in codeigniter. PHP Codeigniter framework uses segment based approach for its URLs, thus making them Search Engine friendly. But those who want to use the good old query string method can turn on this option in code igniter and use it.
In terms of codeigniter: You'll notice that each controller in codeigniter extends the base controller class. Using $this in a controller gives you access to everything which is defined in your controller, as well as what's inherited from the base controller.
You can get it like this:
$this->input->get('some_variable', TRUE);
See this for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With