Php / url-encoding

software development


I am using php to load a text file in part of one of our sites. The http request I make is URL
encoded - but the php is messing up the & (which becomes &) on one of our domains,
but not another.

I have two identitical folders:

Both domains are supposedly running PHP 5.1.2

but… WORK/01%

is returning an error and t%

is not.

This is very strange. The file content/02 WORK/01 ARCHITECTURE & SOCIETY/archsoc.txt
exists in both directories and include/getText.php is exactly the same.

Please help as soon as you can,
Adam Mosseri


Dunno, but I can tell you that you need to URL encode everything. Run your string through urlencode() before sending them to the query string.

It’ll convert & to it’s % equivalent which will in turn prevent PHP from thinking it’s a query seperator.

yerba# rm -rf /etc