Reputation: 2434
I have a small problem with my PHP script. I want to be able to have a URL within a query string so it would look like this:
http://example.com/?url=http://google.com/
This works absolutely fine and $_GET['url']
will return http://google.com
.
The problem is when the URL in my query string already has query string, for example:
http://example.com/?url=http://www.amazon.com/MP3-Music-Download/b/ref=sa_menu_mp3_str?ie=UTF8&node=163856011
will return:
http://www.amazon.com/MP3-Music-Download/b/ref=sa_menu_mp3_str?ie=UTF8
and I want it to return:
http://www.amazon.com/MP3-Music-Download/b/ref=sa_menu_mp3_str?ie=UTF8&node=163856011
I am using PHP for server side.
Could anybody please help?
I am using Codeigniter
, so if this is the reason why it isn't working as it should then please let me know.
Upvotes: 0
Views: 117
Reputation: 5517
You need to encode the url passed as query argument:
urlencode
or rawurlencode
.encodeURIComponent
.Upvotes: 3