huajmbo Posted April 18, 2010 Share Posted April 18, 2010 Hi guys, hopefully you can help with a question that I've been searching for for the last 2 hours. Can you pass a variable to a php script that includes '--' If I call: test.php?data=eQ--tR My script fails to run with a time out But: test.php?data=eQ-tR Works fine Is this a limitation of PHP ? Many thanks, Ed Link to comment https://forums.phpfreaks.com/topic/198942-valid-variables-to-pass-to-script/ Share on other sites More sharing options...
TeddyKiller Posted April 18, 2010 Share Posted April 18, 2010 Not sure about this. Haven't tested, however.. how are the values getting put into the link.. is it nessecary to have double hyphens etc? Link to comment https://forums.phpfreaks.com/topic/198942-valid-variables-to-pass-to-script/#findComment-1044262 Share on other sites More sharing options...
huajmbo Posted April 18, 2010 Author Share Posted April 18, 2010 Hi TeddyKiller, I was having problems with a script that keeps failing. So I'm now down to a "Hello World" script. If I put the url with Firefox: test.php?anything=aa--aa it fails. Unfortunately I need to be able to pass a variable that includes -- Thanks, Ed Link to comment https://forums.phpfreaks.com/topic/198942-valid-variables-to-pass-to-script/#findComment-1044270 Share on other sites More sharing options...
huajmbo Posted April 18, 2010 Author Share Posted April 18, 2010 Here is a link as an example http://test.rarotech.net/hello.php?anything=aa--aa hello.php just includes echo"Hello World"; Thanks Link to comment https://forums.phpfreaks.com/topic/198942-valid-variables-to-pass-to-script/#findComment-1044280 Share on other sites More sharing options...
mikesta707 Posted April 18, 2010 Share Posted April 18, 2010 try using urlencode() on the information you are passing in the URL. for example, if your link looks like $link = "index.php?id=ak--bj"; try [/code] $link = "index.php?id=".urlencode("ak--bj"); [/code] Link to comment https://forums.phpfreaks.com/topic/198942-valid-variables-to-pass-to-script/#findComment-1044293 Share on other sites More sharing options...
TeddyKiller Posted April 18, 2010 Share Posted April 18, 2010 try using urlencode() on the information you are passing in the URL. for example, if your link looks like $link = "index.php?id=ak--bj"; try [/code] $link = "index.php?id=".urlencode("ak--bj"); [/code] Yeah, you just failed with those PHP tags Link to comment https://forums.phpfreaks.com/topic/198942-valid-variables-to-pass-to-script/#findComment-1044299 Share on other sites More sharing options...
huajmbo Posted April 18, 2010 Author Share Posted April 18, 2010 Thanks guys, I've just tried $link = "hello.php?id=".urlencode("ak--bj"); <?php $link = "hello.php?id=".urlencode("ak--bj"); header("Location: http://test.rarotech.net/$link"); ?> And that fails too With the link : $link = "hello.php?id=".urlencode("ak-bj"); it works I also I can't change the -- in the url, it's calling my function from a bank system as a response to a query. Any help appreciated. Thanks Ed Link to comment https://forums.phpfreaks.com/topic/198942-valid-variables-to-pass-to-script/#findComment-1044320 Share on other sites More sharing options...
huajmbo Posted April 18, 2010 Author Share Posted April 18, 2010 Just a follow up. I managed to get it to work on another server. So my host is now 'investigating'. They can't see why it is not working. Possible firewall on the server? Thanks for your time guys Link to comment https://forums.phpfreaks.com/topic/198942-valid-variables-to-pass-to-script/#findComment-1044335 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.