Solved

Using command line

Posted on 2004-05-01
3
279 Views
Last Modified: 2008-03-06
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.
0
Comment
Question by:AkaZn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 14

Expert Comment

by:ThG
ID: 10968574
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
0
 
LVL 3

Accepted Solution

by:
Aliev earned 50 total points
ID: 10972245
On delphi,
shellexecute(handle,'Open',pchar('C:\PHP\php.exe'),pchar('C:\www\test.php >result.txt),'',0);


The results will be written to result.txt file but with headers. You can fix this problem by deleting some lines from file. And then open programmaticaly on delphi result.txt.




0
 

Author Comment

by:AkaZn
ID: 11007209
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.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question