What happens is that I am writing according to the information of a telnet connection with php, but I only manage to create the file when I open the file from the server console in SecureCRT with the command "php file.php", but from the web I do not edit the file or create it or anything, ideas?
function conexion($central,$ip){
if (file_exists("/var/www/html/saraweb/datos_centrales/datos_".$central.".log")){
unlink("/var/www/html/saraweb/datos_centrales/datos_".$central.".log");
}
echo $central;
echo $ip;
$central1 = $central;
$da = fsockopen($ip, 5001, $errno, $errstr, 10);
if (!$da){
echo "$errstr ($errno)<br/>\n";
} else {
$entrada = "user\r\n";
$entrada .="password\r\n";
//$entrada .="allip;\r\n";
$entrada .="alstp;\r\n";
$entrada .="exit\r\n";
fwrite($da, $entrada);
while (!feof($da)) {
$salida = fgets($da, 128);
echo $salida;
eventos($central1,$salida."\n");
echo "<br>";
}
fclose($da);
}
}
but then I do not know how I know how to make it run from the web in HTML as it does from the connection to the server in SecureCRT