Welcome Guest, Not a member yet? Register   Sign In
Not allowing a specific & symbol in Codeigniter URL
#1

Hi all,  I'm new to Codeigniter and stuck in a problem that I can't seem to figure  out at all. Sad

The following URL results in an error which says: "The URI you submitted has disallowed characters."

Code:
http://example.com/index.php?/Paypal/success&tx=8T317791V7961045T&st=Completed&amt=20%2e00&cc=USD&cm=&item_number=

However, if I simply change the & symbol after 'success' to ? like below then everything works fine despite the fact that there are other & symbols in the URL as well. What is going on here? 

Code:
http://example.com/index.php?/Paypal/success?tx=8T317791V7961045T&st=Completed&amt=20%2e00&cc=USD&cm=&item_number=

I tried doing the following in Config.php but it didn't work:

PHP Code:
    $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-\&'

OR 

PHP Code:
    $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-&'

How do I make it so that my original URL is accepted?
Reply
#2

I am guessing that it is because CI is expecting a url of the sort mydomain.co.uk/controller/method

If you are dealing with PayPal all you have to do is change the URL format for the success link to the one you want (from memory). PayPal is sending that url because if thinks you want a url of the form mydomain.co.uk?p=27&something=something

Alternatively there is a setting in the config about changing the way CI deals or interprets URLs, although if you have not used this on the rest of your site it is far easier to change PayPal settings.

I am also guessing that CI is ignoring the ? characters and can ignore the & characters when it is not decoding the controller or method calls but trying to interpret the others as method expected variables.

Hope that makes sense,

Paul.
Reply
#3

(06-06-2016, 07:09 AM)PaulD Wrote: I am guessing that it is because CI is expecting a url of the sort mydomain.co.uk/controller/method

If you are dealing with PayPal all you have to do is change the URL format for the success link to the one you want (from memory). PayPal is sending that url because if thinks you want a url of the form mydomain.co.uk?p=27&something=something

Alternatively there is a setting in the config about changing the way CI deals or interprets URLs, although if you have not used this on the rest of your site it is far easier to change PayPal settings.

I am also guessing that CI is ignoring the ? characters and can ignore the & characters when it is not decoding the controller or method calls but trying to interpret the others as method expected variables.

Hope that makes sense,

Paul.
Hey PaulD, I've been looking around trying to find the way to change the return URL format in Paypal but no success till now. Can you point me to the right direction?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB