function getServerAPI($apiCommand){global $port; $result = ""; $fp = fsockopen("localhost", $port, &$errno, &$errstr, 2); if(!$fp){echo "$errstr ($errno)\n";}else {fputs($fp,"GET /?".$apiCommand." HTTP/1.0\n\n"); $header = true; while(!feof($fp)){$line = fgets($fp,128); // print $line; if ($header == false)$result .= $line . ', '; if (trim($line) == "")$header = false;} fclose($fp);} return substr($result, 0, -2); // trim the last ', '}