简体   繁体   中英

Pass GET param which is another URL with PHP - Codeigniter 3, Apache

I want to pass URL in GET param like this :

SITE URL/b16ee4f31e17df0d3af5?url=https%3A%2F%2Fwww.facebook.com%2F

I am using urlencode to escape characters, but I see 403 Error for this URL, because of some of the characters in the URL GET parameter in this case the dot character.

If I use CI3 function url_title , it will escape dot characters, but I need them because I need valid url in GET parameter.

How can I pass URL get parameter with in some cases with characters like . & ? \\ . & ? \\ . & ? \\ and other characters which can be found in the standart URL ?

You can change $config['permitted_uri_chars'] in your config file

Leave blank to allow all characters -- but only if you are insane.

Also you can do this:

Step 1: $newurl = urlencode(base64_encode('http://google.com'));

Then you will have a string, pass that string as GET parameter and parse it back using:

$realUrl = base64_decode(urldecode($param1));

Where $param1 means the first param of your controller.

Step 2: add = to your $config['permitted_uri_chars'] in your config file

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

add the character what you trying to pass on GET Url. This configure is store on config.php of config folder.

该网址已被编码(也就是说,您只是从地址栏中复制并粘贴了该网址),因此可以将其用于进一步的编码

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM