What is the proper protocol for storing other websites URL’s in your own php page’s URL?
For example if I wanted to store google it would be easy.
MySite.com/test.php?url=http://www.google.com
But what about a URL more complex than http://www.google.com, like if I wanted to store another website’s PHP page.
(e.g. http://www.AnotherSite.com/page1.php?key=value&key2=value2&key3=value3)
Then how would I store it in my PHP page’s URL? Do you replace all of the “&” symbols with a “\&” phrase? Is there a better method? Does that even work in the first place?
Thanks!!!
If you don’t want to think about it:
Otherwise:
You could also use
rawurlencode(). Notable difference is that it follows RFC 3986.Further reading:
http_build_query()urlencode()rawurlencode()