php-windows Digest 21 Jun 2011 09:15:03 -0000 Issue 3960

Topics (messages 30666 through 30672):

where is source code for urlencode and urldecode?
        30666 by: JDS
        30668 by: Richard Quadling
        30669 by: Richard Quadling

Re: STDOUT and STDERR with php.exe and php-win.exe on Win XP
        30667 by: Richard Quadling
        30671 by: JDS

How to do Press Any Key To Continue with php.exe
        30670 by: JDS
        30672 by: Richard Quadling

Administrivia:

To subscribe to the digest, e-mail:
        php-windows-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-windows-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-wind...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Where can I find the source code for urlencode and urldecode functions?

I need to port them over to AutoHotKey script.

Thanks

--- End Message ---
--- Begin Message ---
On 20 June 2011 18:24, JDS <j...@forerunnertv.com> wrote:
> Where can I find the source code for urlencode and urldecode functions?
>
> I need to port them over to AutoHotKey script.
>
> Thanks

Start at 
http://svn.php.net/viewvc/php/php-src/trunk/ext/standard/url.c?view=markup#l524
and read down from there.


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--- End Message ---
--- Begin Message ---
On 20 June 2011 18:24, JDS <j...@forerunnertv.com> wrote:
> Where can I find the source code for urlencode and urldecode functions?
>
> I need to port them over to AutoHotKey script.
>
> Thanks

Sorry..

Between 
http://svn.php.net/viewvc/php/php-src/trunk/ext/standard/url.c?view=markup#l463
and #l687


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--- End Message ---
--- Begin Message ---
On 20 June 2011 18:18, JDS <j...@forerunnertv.com> wrote:
> I am trying to figure out how this all works on Win XP...
>
> When I call php.exe or php-win.exe from another script (AutoHotKey in my
> case), do both of these programs use stdout and stderr? I know php.exe has a
> console window and php-win.exe does not, but just need to know how they
> output the results.
>
> Thanks

STDOUT is the normal output for php.exe.

To write to the STDERR, you can ...

php -r "file_put_contents('php://STDERR', 'This is an error');" >
PHP_STDOUT.txt 2> PHP_STDERR.txt

2011-06-20  17:26                16 PHP_STDERR.txt
2011-06-20  17:26                 0 PHP_STDOUT.txt

OOI. If you want to use PHP scripts to act as a filter. E.g.

command | php script, then read
http://docs.php.net/manual/en/install.windows.commandline.php

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--- End Message ---
--- Begin Message ---
On 6/20/2011 11:27 AM, Richard Quadling wrote:
On 20 June 2011 18:18, JDS<j...@forerunnertv.com>  wrote:
I am trying to figure out how this all works on Win XP...

When I call php.exe or php-win.exe from another script (AutoHotKey in my
case), do both of these programs use stdout and stderr? I know php.exe has a
console window and php-win.exe does not, but just need to know how they
output the results.

Thanks
STDOUT is the normal output for php.exe.

To write to the STDERR, you can ...

php -r "file_put_contents('php://STDERR', 'This is an error');">
PHP_STDOUT.txt 2>  PHP_STDERR.txt

2011-06-20  17:26                16 PHP_STDERR.txt
2011-06-20  17:26                 0 PHP_STDOUT.txt

OOI. If you want to use PHP scripts to act as a filter. E.g.

command | php script, then read
http://docs.php.net/manual/en/install.windows.commandline.php

What about php-win.exe? Does it write to STDOUT as well even though there is no console window?

Thanks

--- End Message ---
--- Begin Message --- I am wondering if there is a better way to do this than what I have come up with. The first example waits for the ENTER key to be pressed, but any other characters you press show up on the screen

The second method works with any key being pressed, but uses exec().

Any other suggestions? Basically I am wanting the console window to stay open at the end of the script so the user can read what was displayed in the window before the console window closes down.

Thanks

> php test.php

<?php
//test. php

//Not the most elegant, but it works!
echo "\n\n";
echo "Press ENTER to continue... ";
$handle = fopen("php://stdin","r");
$getLine = "";
while ($getLine == ""):
    $getLine = fgets($handle);
endwhile;

//A little better but uses exec()
echo "\n\n";
echo "Press ANY KEY to continue... ";
exec("pause");

?>

--- End Message ---
--- Begin Message ---
On 20 June 2011 23:26, JDS <j...@forerunnertv.com> wrote:
> I am wondering if there is a better way to do this than what I have come up
> with. The first example waits for the ENTER key to be pressed, but any other
> characters you press show up on the screen
>
> The second method works with any key being pressed, but uses exec().
>
> Any other suggestions? Basically I am wanting the console window to stay
> open at the end of the script so the user can read what was displayed in the
> window before the console window closes down.
>
> Thanks
>
>> php test.php
>
> <?php
> //test. php
>
> //Not the most elegant, but it works!
> echo "\n\n";
> echo "Press ENTER to continue... ";
> $handle = fopen("php://stdin","r");
> $getLine = "";
> while ($getLine == ""):
>    $getLine = fgets($handle);
> endwhile;
>
> //A little better but uses exec()
> echo "\n\n";
> echo "Press ANY KEY to continue... ";
> exec("pause");
>
> ?>

@ECHO OFF
C:\PHP5\php.exe C:\Path\to\Script.php --arg1 --arg2 --arg3
PAUSE




-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--- End Message ---

Reply via email to