note 68153 added to wrappers
| From: | groolot at groolot dot net | Date: | Sat, 15 Jul 2006 15:44:46 +0000 |
| Subject: | note 68153 added to wrappers | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114804@lists.php.net to get a copy of this message | ||
#!/usr/bin/php
#
# This script allow you to urlencode a string given to it
# by a pipe.
#
# If its name is : my_script.php (755)
# you can invoke it by :
# prompt:~$ echo "Does it work ?" | my_script.php
#
# and it will return :
#
# Does+it+work+%3F
#
#
<?php
// Opening input stream
$my_stdin = fopen("php://stdin", 'r');
// Stream reading until end of line
$my_string = fgets($my_stdin);
// Return the string urlencoded without the end of line
$my_stdout = fopen("php://stdout", 'w');
fwrite($my_stdout, urlencode(substr($my_string, 0, strlen($my_string) - 1)));
?>
----
Server IP: 66.163.161.117
Probable Submitter: 89.82.236.51
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/wrappers.php
Edit -- http://master.php.net/note/edit/68153
Del: integrated -- http://master.php.net/note/delete/68153/integrated
Del: useless -- http://master.php.net/note/delete/68153/useless
Del: bad code -- http://master.php.net/note/delete/68153/bad+code
Del: spam -- http://master.php.net/note/delete/68153/spam
Del: non-english -- http://master.php.net/note/delete/68153/non-english
Del: in docs -- http://master.php.net/note/delete/68153/in+docs
Del: other reasons-- http://master.php.net/note/delete/68153
Reject -- http://master.php.net/note/reject/68153
Search -- http://master.php.net/manage/user-notes.php