I have written this little bit of code as to rawurldecode urls at the command line and it works fine for piped data but not argument provided data
#!/usr/bin/php
<?php
if($argc2 == 2) {
$todecode=$argv[1];
} else {
if(!$fp = fopen('php://stdin','r')) {
die('Could not open STDIN');
}
$todecode='';
while(!feof($fp)) {
$todecode.=fgets($fp, 1024);
}
}
echo(rawurldecode($todecode));
?>
If I put double quotes around the string it still tries to run it as seperate background commands (the particular url has three unencoded apersands) and just hangs. With single quotes it just plain hangs.
Any Ideas?
Thanks
Bubble