PHP Corrupts URLs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a php script that gets a url from a GET query parameter. I have been running this script on PHP 5.2.2 on Ubuntu Linux, and everything works as expected. I have just installed PHP 5.2.3 on OS X via MacPorts, and the same query parameter url has any single quote characters escaped with a backslash when I retrieve it from $_REQUEST.

$url = $_REQUEST['url'];
print($url);

For the Query Parameter:

http://localhost/drones/serp.php?def=planetrealtor.com.xml&url=http%3A%2F%2Fwebapp
s2.planetrealtor.com%2Fidx%2Fpkg_IDX.pr_ListOfIDXProperties%3FsStateID%3DFL%26sRealtorID%3D%26sUserType%3DS%26sTrackNum%3D%26sSear
chType%3D%26sPropertyTypeCode%3DS%26sSQLPreBuiltWhere%3DL.PROPERTY_STATE_ID%2520%3D%2520%27FL%27%2520AND%2520L.NODISPLAY_IDX%2520I
S%2520NULL%2520%2520AND%2520L.NODISPLAY_OWNER%2520IS%2520NULL%2520%2520AND%2520L.VOW_ENABLED_LIST_FIRM_ONLY%2520IS%2520NULL%2520%2
520AND%2520L.STATUS_CODE%2520%3D%2520%27A%27%2520AND%2520L.STATEPROP_ENABLED%2520IS%2520NOT%2520NULL%2520%2520AND%2520%2520L.MLS_I
D%2520IN%2520%28%27flagler%27%2C%27miamimls%27%2C%27spacecoast%27%2C%27staug%27%2C%27neflmlsinc%27%2C%27navarre%27%2C%27sanibel%27
%2C%27sarasota%27%2C%27pensacola%27%2C%27highlands%27%2C%27hernando%27%2C%27franklin%27%2C%27naples%27%2C%27southbrow%27%2C%27indi
an%27%2C%27manatee%27%2C%27baycounty%27%2C%27regional%27%2C%27palmbeach%27%2C%27emerald%27%2C%27citrus%27%2C%27ocala%27%2C%27dixie
%27%2C%27fortlaud%27%2C%27gaines%27%2C%27englewood%27%2C%27westpasco%27%2C%27okee%27%2C%27bonita%27%2C%27capecoral%27%2C%27ftmyers
%27%2C%27venice%27%2C%27talla%27%2C%27chipola%27%2C%27marathon%27%2C%27midfl%27%2C%27miamidade%27%2C%27marco%27%2C%27martin%27%2C%
27puntagorda%27%2C%27keywest%27%2C%27amelia%27%2C%27lakecity%27%2C%27pinellas%27%29%2520AND%2520L.ZIP_CODE%2520IN%2520%28%2734211%
27%29%2520AND%2520L.PROPERTY_TYPE_CODE%2520%3D%2520%27S%27%2520AND%2520L.SALE_PRICE%2520%253E%3D%25200%2520AND%2520L.SALE_PRICE%25
20%253C%3D%252099999999999%26sSQLPreBuiltOrderBy%3D%26sDisplayPhoto%3DT%26sSearchSource%3DX%26sOnlyCities%3DF%26sRunSearch%3DF%26s
SearchID%3D%26sClientID%3D%26sSavedSearchType%3D%26sLangCode%3DENGLISH%26sSubSystemCode%3D%26nPgNum%3D1%26nNum%3D1

In Linux becomes:

http://webapps2.planetrealtor.com/idx/pkg_IDX.pr_ListOfIDXProperties?sStateID=FL&sRealtorID=&sUserType=S&sTrackNum=&sSearchType=&sPropertyTypeCode=S&sSQLPreBuiltWhere=L.PROPERTY_STATE_ID%20=%20'FL'%20AND%20L.NODISPLAY_IDX%20IS%20NULL%20%20AND%20L.NODISPLAY_OWNER%20IS%20NULL%20%20AND%20L.VOW_ENABLED_LIST_FIRM_ONLY%20IS%20NULL%20%20AND%20L.STATUS_CODE%20=%20'A'%20AND%20L.STATEPROP_ENABLED%20IS%20NOT%20NULL%20%20AND%20%20L.MLS_ID%20IN%20('flagler','miamimls','spacecoast','staug','neflmlsinc','navarre','sanibel','sarasota','pensacola','highlands','hernando','franklin','naples','southbrow','indian','manatee','baycounty','regional','palmbeach','emerald','citrus','ocala','dixie','fortlaud','gaines','englewood','westpasco','okee','bonita','capecoral','ftmyers','venice','talla','chipola','marathon','midfl','miamidade','marco','martin','puntagorda','keywest','amelia','lakecity','pinellas')%20AND%20L.ZIP_CODE%20IN%20('32714')%20AND%20L.PROPERTY_TYPE_CODE%20=%20'S'%20AND%20L.SALE_PRICE%2
0%3E=%200%20AND%20L.SALE_PRICE%20%3C=%2099999999999&sSQLPreBuiltOrderBy=&sDisplayPhoto=T&sSearchSource=X&sOnlyCities=F&sRunSearch=F&sSearchID=&sClientID=&sSavedSearchType=&sLangCode=ENGLISH&sSubSystemCode=&nPgNum=1&nNum=1

But in OS X becomes:

http://webapps2.planetrealtor.com/idx/pkg_IDX.pr_ListOfIDXProperties?sStateID=FL&sRealtorID=&sUserType=S&sTrackNum=&sSearchType=&sPropertyTypeCode=S&sSQLPreBuiltWhere=L.PROPERTY_STATE_ID%20=%20\'FL\'%20AND%20L.NODISPLAY_IDX%20IS%20NULL%20%20AND%20L.NODISPLAY_OWNER%20IS%20NULL%20%20AND%20L.VOW_ENABLED_LIST_FIRM_ONLY%20IS%20NULL%20%20AND%20L.STATUS_CODE%20=%20\'A\'%20AND%20L.STATEPROP_ENABLED%20IS%20NOT%20NULL%20%20AND%20%20L.MLS_ID%20IN%20(\'flagler\',\'miamimls\',\'spacecoast\',\'staug\',\'neflmlsinc\',\'navarre\',\'sanibel\',\'sarasota\',\'pensacola\',\'highlands\',\'hernando\',\'franklin\',\'naples\',\'southbrow\',\'indian\',\'manatee\',\'baycounty\',\'regional\',\'palmbeach\',\'emerald\',\'citrus\',\'ocala\',\'dixie\',\'fortlaud\',\'gaines\',\'englewood\',\'westpasco\',\'okee\',\'bonita\',\'capecoral\',\'ftmyers\',\'venice\',\'talla\',\'chipola\',\'marathon\',\'midfl\',\'miamidade\',\'marco\',\'martin\',\'puntagorda\',\'keywest\',\'amelia\',\'lakecity\',\'pinellas\')%20AND
%20L.ZIP_CODE%20IN%20(\'32714\')%20AND%20L.PROPERTY_TYPE_CODE%20=%20\'S\'%20AND%20L.SALE_PRICE%20%3E=%200%20AND%20L.SALE_PRICE%20%3C=%2099999999999&sSQLPreBuiltOrderBy=&sDisplayPhoto=T&sSearchSource=X&sOnlyCities=F&sRunSearch=F&sSearchID=&sClientID=&sSavedSearchType=&sLangCode=ENGLISH&sSubSystemCode=&nPgNum=1&nNum=1

As you can see, in OS X the url acquires a the backslashes, which I would like to avoid.

I am not much of a PHP programmer at this point--it is a brand new language for me, so I don't really now how to investigate this. Is there a PHP configuration option I can look at? Is there a way to test in my script for the OS I am running on, and branch accordingly? Has anyone seen this problem before.

Hope this is the appropriate place to post.

Thanks for the help.

Best,

Nathan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux