Link to home
Start Free TrialLog in
Avatar of AkaZn
AkaZn

asked on

Using command line

How can I use some program like Delphi or Visual C++ to get information from php file with command line. Exam:

a.php
<?php
$a=12;
echo '<html>';
echo $a;
echo '</html>'
?>

When I run the command c:\php\php.exe c:\test\a.php , it show out the command line :

<html>
12
</html>

How can I get that information from other program.
Avatar of Giovanni G
Giovanni G
Flag of Italy image

This doesn't have anything to do with PHP, but i'll reply anyway. You have to actually "run" your php script, exactly the same way when you do c:\php\php.exe c:\test\a.php.

See this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp

and this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/creating_processes.asp
ASKER CERTIFIED SOLUTION
Avatar of Aliev
Aliev
Flag of Azerbaijan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AkaZn
AkaZn

ASKER

shellexecute(handle,'Open',pchar('C:\PHP\php.exe'),pchar('C:\www\test.php >result.txt),'',0);


I think that the >filename command can only be used in msdos or nc. I have try your function but it doesn't work. But anyway, you are right. I use that command instead:

shellexecute(handle,'Open',pchar('command'),pchar('/C 'C:\PHP\php.exe C:\www\test.php >result.txt),'',1);

It will use command (msdos) and excute php.exe.