i have a script that i am using and part of the url is another url, but when i run the script its not doing what i want.

for example: lets say i have a url that i want to include into another url. i want to include the url: http://www.wallpaperama.com/forums/topic45.html

ok, now i want to put this url into another url, like this:

http://www.wallpaperama.com/?url=http://www.wallpaperama.com/forums/topic45.html

this is when it errors out, it doesnt do what i want it to do.

here is the solution. if you are also having this problem, this is how you can go buy and fix it.

urlencode()

you can use the urlencode() function in php to make the the ulr within the url work.

so if i did this in php:
<?php
echo urlencode('http://www.wallpaperama.com/forums/topic45.html');
?>


this would be the output:
http%3A%2F%2Fwww.wallpaperama.com%2Fforums%2Ftopic45.html


this is better now, because now i can put the link in my pages:

ENCODED URL:
http://www.wallpaperama.com/?url=http%3A%2F%2Fwww.wallpaperama.com%2Fforums%2Ftopic45.html

NOT ENCODED URL:
http://www.wallpaperama.com/?url=http://www.wallpaperama.com/forums/topic45.html

See the diffence?


ok, how do i get the value of $_GET['url']?
if you do this :

<?php
echo $_GET['url']
?>


you will get this:
http%3A%2F%2Fwww.wallpaperama.com%2Fforums%2Ftopic45.html


but thats now what i want, i want to change it back to

simple, to change the url back to normal text http://www.wallpaperama.com/forums/topic45.html

well, u use the urldecode() function in php

<?php
echo urldecode($_GET['url'])
?>