Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using command line

Posted on 2004-05-01
3
Medium Priority
?
294 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 200 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

618 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