Some links fail even though they are accessible
<!DOCTYPE html>
<html lang="en">
<?php
require('simple_html_dom.php');
include('connect.php');
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
$query = mysqli_query($con,"SELECT * FROM link2");
?>
<table id="keywords" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th class="text-left">NAME</th>
<th class="text-left">NAS IP</th>
<th class="text-left">MAX IN</th>
<th class="text-left">MAX OUT</th>
<th class="text-left">STATUS</th>
<th id="nm">BEEP</th>
</tr>
</thead>
<tbody class="table-hover">
<?php
Here I am looping through the urls from the db and checking for connection. Settings of my php.ini
file seem to be working correctly
while($row = mysqli_fetch_array($query))
{
$name = $row['name'];
$url = $row['links'];
$html = @file_get_contents($url);
if ($html)
{
$state = "ACCESS";
$html = file_get_html($row['links']);
$in = $html->find('p', 0)->children(0);
$trial = explode(";",$in);
$in = (strip_tags($trial[0]));
$out = $html->find('p', 0)->children(2);
$trial2 = explode(";",$out);
$out = (strip_tags($trial2[0]));
$str = $in;
preg_match_all('!\d+(?:\.\d+)?!', $str, $matches);
$floats = array_map('floatval', $matches);
$int = (float)$matches[0][0];
$str2 = $out;
preg_match_all('!\d+(?:\.\d+)?!', $str2, $matches);
$floats = array_map('floatval', $matches);
$int2 = (float)$matches[0][0];
if($int < $row['min'] || $int2 < $row['max'])
{
$display = "BEEP";
}
else{
$display = " ";
}
Displaying the table
echo "".$row['name']."".$row['nas_ip']."".$in."".$out."".$state."".$display.""; } else { $state = "NO ACCESS"; $display = "BEEP";
echo "<tr><td>".$row['name']."</td><td>".$row['nas_ip']."</td><td></td><td></td><td>".$state."</td><td>".$display."</td></tr>";
}
unset($html);
}
?>
</tbody>
</table>
</body>
</html>
enter code here