<?php require_once "../lib/mpd.php"; require_once "../config.php"; $mpd = new MPD(SERVER, PORT); $mpd->connect(); if (isset($_GET['cmd'])) { if (isset($_GET['args'])) { $results = $mpd->{$_GET}['cmd']($_GET['args']); } else { $results = $mpd->{$_GET}['cmd'](); } } else { $results = $mpd->send($_GET['msg']); } $mpd->disconnect(); echo json_encode($results);
<?php require_once "../lib/mpd.php"; require_once "../config.php"; $mpd = new MPD(SERVER, PORT); $property = $_GET['property']; $mpd->connect(); $status = $mpd->getStatus(); $bool = $status[$property]; $mpd->send($property . " " . ($bool == 0 ? 1 : 0)); $mpd->disconnect();