Welcome Guest, Not a member yet? Register   Sign In
URI Segments and payment gw

In payment gatway ,most of the time there is a option for return url

and the payment gatway send reply like

But it doesnot work with CI URI Segments(controler/method). Is there a way to solve it
without disabling "URI Segments" like enabling query string for a specific script(ie,thanks.php)?

You are asking two things here.

If you are using a payment gateway that redirects you to a file you are out of the CI environment and you can do whatever you want.

If the payment gateway redirects you to a CI url, for example myshop.com/order/thanks try to find where it adds the query string and rewrite it as a pathinfo url, if you want you can keep the keys and have a url like myshop.com/order/thanks/vala/dsgdfhgfdh/valb/dsgdfhgdf. But it would be even better if you can access the values from the gateway in the tanks controller method because users don't need to know your content comes from somwhere else.

a quick fix solution is to set enable_query_string to true and the uri_protocol setting to PATHINFO but it's best to avoid this because then all your urls are accessible with clean (order/thanks) and query string (c=order&m=thanks) url segments.

Even if you disable query strings in CodeIgniter, you can still access them by using:


For example:

$query_string = $this->input->server('QUERY_STRING',TRUE);

$vars = explode('&',$query_string);
$get = array();
foreach($vars as $var){
    list($key,$value) = explode('=',$var);
    $get[$key] = urldecode($value);

You can then access the $_GET variables by using $get

simonmaddox the problem is CI thinks thanks?vala=dsgdfhgfdh&valb=dsgdfhgdf is one segment because of the AUTO uri_protocol setting. So if the query string isn't needed you don't have to set the enable_query_strings to true.

But i think you struck a gem by using the $_SERVER key QUERY_STRING because the enable_query_strings settings also opens the door to two urls linking to the same conent and CI's input initialization only cleans the $_GET global by default. I need to do a few test to confirm this, but thanks for pointing me in the direction.

not clear why it is not working as you said

class Auth extends Controller {  
function __construct()

function payment($name,$pass)
    echo 'here'  ;

     $query_string = $this->input->server('QUERY_STRING',TRUE);
$vars = explode('&',$query_string);
$get = array();
foreach($vars as $var){
    list($key,$value) = explode('=',$var);
    $get[$key] = urldecode($value);



it shows 'here'



404 Page Not Found

Is that a server 404, or a CI 404?

If it's a server 404, check your .htaccess file. Here's mine:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

that is CI error.

404 Page Not Found
The page you requested was not found.

[quote author="learnq" date="1230658754"]that is CI error.

404 Page Not Found
The page you requested was not found.[/quote]

Not sure what the issue might be. Maybe it's something in your config.php file?

Here's mine (minus comments):

$config['base_url']    = "REMOVED";
$config['index_page'] = "";
$config['uri_protocol']    = "AUTO";
$config['url_suffix'] = "";
$config['language']    = "english";
$config['charset'] = "UTF-8";
$config['enable_hooks'] = TRUE;
$config['subclass_prefix'] = 'MY_';
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['log_threshold'] = 0;
$config['log_path'] = '';
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['cache_path'] = '';
$config['encryption_key'] = "";
$config['sess_cookie_name']        = 'REMOVED_session';
$config['sess_expiration']        = 0;
$config['sess_encrypt_cookie']    = FALSE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']        = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update'] = 300;
$config['cookie_prefix']    = "";
$config['cookie_domain']    = "";
$config['cookie_path']        = "/";
$config['global_xss_filtering'] = TRUE;
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;



A PHP Error was encountered
Severity: Warning

Message: preg_match() [function.preg-match]: Compilation failed: range out of order in character class at offset 20

Filename: libraries/URI.php

Line Number: 189

The URI you submitted has disallowed characters.

Theme © iAndrew 2016 - Forum software by © MyBB