Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] svdrsend.php
#include <hallo.h>
When somebody is interested in a PHP-Version of "svdrsend.pl" here is one.
(I'm not sure if you have to compile PHP with "--enable-sockets" as i have
first tried with the PHP4-Socks (Where you have to use "--enable-sockets")
and later redone it with the PHP3-backwartcompatibel "fsockopen")
- Use Scissors here -
<HTML>
<HEAD>
<TITLE>SVDRsend.php</TITLE>
</HEAD>
<BODY>
<?
/* Default Port, if Port is not set*/
if (!$port) {
$port = "2001";
}
/* Default Target, if target is not set */
if (!$address) {
$address = "localhost";
}
if (!$command) {
?>
<h2>Enter command</h2>
<FORM METHOD=POST>
Adress:Port<INPUT TYPE=TEXT NAME=address size=30 value="<?=$address?>">:<INPUT TYPE=TEXT NAME=port size=5 value="<?=$port?>"><BR>
Command:<INPUT TYPE=TEXT NAME=command size=100><BR>
<INPUT TYPE=SUBMIT VALUE="Fire">
</FORM>
<?
} else {
error_reporting (E_ALL);
echo "<h2>svdrsend.php</h2>\n";
$socket = fsockopen ($address, $port, $errno, $errstr, 10);
$lines = VDRRead($socket);
if ($command != "") {
$in = $command;
} else {
$in = "HELP";
}
$out = '';
VDRWrite ($socket, $in);
echo "<TABLE BORDER><TR><TD>";
$lines = VDRRead($socket);
foreach ($lines as $value) {
echo "$value<BR>\n";
}
echo "</TD></TR></TABLE>";
VDRWrite ($socket, "QUIT");
fclose ($socket);
?>
<BR>Another command?<BR>
<FORM METHOD=POST>
<INPUT TYPE=TEXT NAME=command size=100><BR>
<INPUT TYPE=HIDDEN NAME=address value="<?=$address?>">
<INPUT TYPE=HIDDEN NAME=port value="<?=$port?>">
<INPUT TYPE=SUBMIT VALUE="Fire">
</FORM>
<?
}
function VDRWrite($socket, $content) {
chop ($content);
fputs ($socket, "$content\r\n");
}
function VDRRead($socket) {
$count = 0;
while (($out = fgets ($socket, 2048)) != -1 ) {
$return[$count] = $out;
$count++;
if (substr($out,3,1) != "-") {
return $return;
}
}
}
?>
</BODY>
- Use Scissors here -
Bis denn
--
Real Programmers consider "what you see is what you get" to be just as
bad a concept in Text Editors as it is in women. No, the Real Programmer
wants a "you asked for it, you got it" text editor -- complicated,
cryptic, powerful, unforgiving, dangerous.
--
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.
Home |
Main Index |
Thread Index