2014-04-26 175 views
1

我在我的機器上使用了Ampache(一種基於網絡的音樂播放器),並且我試圖自動執行下面代碼中列出的「play_democratic」功能 粗體。從命令行(PHP)點擊網站上的「播放」按鈕

這個功能只是播放音樂(看起來像在網頁上播放按鈕) 但我想通過命令行(Xubuntu上13.10)

因此,這將是這個樣子

執行的函數
`sudo php show_democratic.inc.php play_democratic` 

請注意,網站使用身份驗證,所以我不知道如何將該信息傳遞到命令行,或者如果我需要創建一個shell腳本來執行該功能。

我正在運行xubuntu 13.10

查看下面完整的PHP文件內容。

<?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

好吧,這是我在這個網站上的第一篇文章,所以很抱歉我的sucky格式與代碼佈局。 – user3575409

+0

你看**'玩'),'play_democratic'); ?> **是膽識。 – user3575409

回答

0

如果您嘗試從命令行與Web應用程序交互,則不需要修改Web應用程序代碼。你可以通過像cUrl這樣的命令行工具簡單地調用URL。