Re: Command line PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 7, 2011, at 8:50 PM, David Hutto wrote:

> On Fri, Jan 7, 2011 at 8:44 PM, TR Shaw <tshaw@xxxxxxxx> wrote:
>> 
>> On Jan 7, 2011, at 8:36 PM, David Hutto wrote:
>> 
>>> I'm with some of the others above on using Python. Writing a command
>>> line app is about as simple as:
>>> 
>>> import subprocess
>>> word = 'hello'
>>> self.espeak = subprocess.Popen(['espeak', word], stdout =
>>> subprocess.PIPE).communicate()[0]
>>> 
>>> I think of PHP as more browser, than desktop app/webapp.
>> 
>> 
>> And in php the above is just:
>> 
>> echo "hello";
>> 
>> Which is simpler?  The answer is the one that you are most comfortable with.
> 
> I expect this might have been meant to go to the list, but I'll reply
> directly back.
> 
> With the espeak installed. This calls a command line from your python
> script, and speaks the word, not just display. I understand this might
> be direct with certain abilities to display and speak the info.
> In python2.x it would be
> 
> print 'hello', or print "hello", notice no ';'.
> 
> How would you call a command line(from terminal) script from within a
> php desktop app? That was what the above was meant to demonstrate in
> python, not print it out to page, or terminal. But I'm guessing it
> might not be that different.

Sorry, David I should not reply quickly when I have a cold but again its all pretty similar. Here it is on unix/linux.

PHP:

$word = "hello";
exec("say \"$word\"");

Bash:

word="hello"
say "$word"

In all the languages its hust:

1) set a variable
2) call an external program with the variable as an argument

after that its all about language specific syntax.

Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux