2014-04-26 2 views
1

에서 웹 사이트의 "재생"버튼을 클릭하십시오. 내 컴퓨터에서 Ampache (웹 기반 뮤직 플레이어)를 사용하고 있으며 아래 코드에 나열된 "play_democratic"기능을 자동화하려고합니다. 굵게.명령 줄 (PHP)

이 기능은 단순히 음악을 재생합니다 (웹 페이지에서 재생 버튼 모양) 하지만이 기능은 명령 행 (분투 13.10)

는 그래서이

과 같을 것입니다 통해 실행하려면
`sudo php show_democratic.inc.php play_democratic` 

웹 사이트는 인증을 사용하므로 명령 줄에 정보를 전달하는 방법이나 기능을 실행하기 위해 셸 스크립트를 만들어야하는지 잘 모르겠습니다.

저는 xubuntu를 실행하고 있습니다. 13.10

아래의 전체 내용을 읽으십시오.

<?php 
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */ 
/** 
* 
* LICENSE: GNU General Public License, version 2 (GPLv2) 
* Copyright 2001 - 2013 Ampache.org 
* 
* This program is free software; you can redistribute it and/or 
* modify it under the terms of the GNU General Public License v2 
* as published by the Free Software Foundation. 
* 
* This program is distributed in the hope that it will be useful, 
* but WITHOUT ANY WARRANTY; without even the implied warranty of 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
* GNU General Public License for more details. 
* 
* You should have received a copy of the GNU General Public License 
* along with this program; if not, write to the Free Software 
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
* 
*/ 

$string = $democratic->is_enabled() ? sprintf(T_('%s Playlist') ,$democratic->name) : T_('Democratic Playlist'); 
UI::show_box_top($string , 'info-box'); 
?> 
<div id="information_actions"> 
<ul> 
<?php if ($democratic->is_enabled()) { ?> 
<li> 
<?php echo T_('Cooldown'); ?>:<?php echo $democratic->f_cooldown; ?> 
</li> 
<?php } ?> 
<?php if (Access::check('interface','75')) { ?> 
<li> 
<a href="<?php echo AmpConfig::get('web_path'); 
?>/democratic.php?action=manage"><?php echo UI::get_icon('server_lightning', 
T_('Configure Democratic Playlist')); ?></a> 
<?php echo T_('Configure Democratic Playlist'); ?> 
</li> 
<?php if ($democratic->is_enabled()) { ?> 
<li> 
<?php echo Ajax::button('?page=democratic&action=send_playlist&democratic_id=' . 
scrub_out($democratic->id),'all', T_(**'Play'),'play_democratic'); ?>** 
<?php echo T_('Play Democratic Playlist'); ?> 
</li> 
<li> 
<?php echo Ajax::button('?page=democratic&action=clear_playlist&democratic_id=' . 
scrub_out($democratic->id),'delete', T_('Clear Playlist'),'clear_democratic'); ?> 
<?php echo T_('Clear Playlist'); ?> 
</li> 
<?php } ?> 
<?php } ?> 
</ul> 

</div> 
<?php UI::show_box_bottom(); ?> 
+0

이 사이트의 첫 번째 게시물입니다. 코드 레이아웃으로 짜증나는 형식에 대해 사과드립니다. – user3575409

+0

** 'Play'참조), 'play_democratic'); ?> **은 대담하게 강조했다. – user3575409

답변

0

명령 줄에서 웹 응용 프로그램과 상호 작용하려는 경우 웹 응용 프로그램 코드를 수정할 필요가 없습니다. cUrl과 같은 명령 줄 유틸리티를 통해 URL을 호출하기 만하면됩니다.