You are here: Re: How to pass variable to operating system. « All PHP « IT news, forums, messages
Re: How to pass variable to operating system.

Posted by J.O. Aho on 10/11/07 04:45

Henk Oegema wrote:
> J.O. Aho wrote:
>
>> Henk Oegema wrote:
>>> J.O. Aho wrote:
>>>
>>>> As you can't export three shell variables at the same time, you require
>>>> to set them one at the time. If you still want to output all three at
>>>> the same time in the php script, then you need to use awk or another
>>>> string manipulating command and in which case it's less overhead to make
>>>> a shell script that does all itself.
>>> Now it's clear to me how it works. :)
>>>
>>> exten => 3014,n,Set(uptime=${CURL(http://localhost/uptime/uptime.php)})
>> Why use CURL???
>> As you are asking something from the localhost, which means the php script
>> is directly accessible without any use of a web server.
> Yes, the php script is directly accessible.
> But I don't have enough knowledge of how to do that.
>
> Is there another (better) way to assign the value to the variable uptime
> from the php script?
>
php somescript.php = CURL(http://localhost/uptime/uptime.php)

You can do the following

--- yourscript ---
#!/usr/bin/php
<?PHP
echo "My script\n";
?>
--- eof ---

chmod 755 yourscript

$ ./yourscript
My script
$

And now you don't use the php to execute the script, it's all built in.
See to that the path is correct where php binary is located-

--

//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация