Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

"&" in a url and php?

Ee Maculate
Owner of Fourmile Castle
Join date: 11 Jan 2007
Posts: 919
04-27-2009 02:22
I'm working on a project for which the easiest way to do things is to use php to display an image via media settings.. unfortunately this method requires sending an "&" as part of the url. This works fine when sending direct to a cgi script, but to the php as soon as it sees an "&" it thinks it's looking for another variable.

I guess I'm not being very clear... ! Say I want to send a url something like:

http://www.nowhere.com/display.php?name=something&something

Is there a way to send this url so that the variable name is actually "something&something" rather than "something"? So far the only solution I've got is to change the "&" to something else before sending the url and then the php changes it back... but there must be a less messy way?

(for the curious I am making a viewer to display LaTeX mathematical equations from chat commands.. the ampersand is used for separating elements in an array/matrix... everything is eventually sent to a cgi script which is fine, but I want a php in the middle to deal with page formatting).
Ee Maculate
Owner of Fourmile Castle
Join date: 11 Jan 2007
Posts: 919
04-27-2009 03:40
Sorry... have answered my own question!

You can use $_SERVER['REQUEST_URI'] and strip out the leading directory and filename bits. I knew there must have been something simple! :)
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
04-27-2009 14:00
You could also use the url-encoded-character for the '&' which is %26. so your request would be: http://www.nowhere.com/display.php?name=something%26something