Datasheet
API PHP package
50
<td><?php echo $entry('message'); ?></td>
</tr><?php } ?>
</tbody>
</table>
<?php } ?></body>
</html>
Ping from router
This example is particularly useful when you want to ping someone from inside the network while browsing the
page from outside the network.
<?php
use PEAR2\Net\RouterOS;
require_once 'PEAR2/Autoload.php';
if (isset($_GET['act'])) {//This is merely to ensure the form was submitted.
//Adjust RouterOS IP, username and password accordingly.
$client = new RouterOS\Client('192.168.0.1', 'admin', 'password');
//This is just one approach that allows you to create a multi purpose form,
//with ping being just one action.
if ($_GET['act'] === 'Ping' && isset($_GET['address'])) {
//Ping can run for unlimited time, but for PHP,
//we need to actually stop it at some point.
$pingRequest = new RouterOS\Request('/ping count=3');
$results = $client->sendSync($pingRequest->setArgument('address', $_GET['address']));
}
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Ping someone</title>
</head>
<body>
<div>
<form action="" method="get">
<ul>
<li>
<label for="address">Address:</label>
<input type="text" id="address" name="address" value="<?php
if (isset($_GET['address'])) {
echo htmlspecialchars($_GET['address']);
}
?>" />










