Código PHP:
function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
include ('./conexion/conexion.php');
$buscar = mysqli_query($cn,"SELECT * FROM mitabla") or die("Error: ".mysqli_error($cn));
while($al = mysqli_fetch_assoc($buscar)) {
?>
<tr>
<td><?php
$options = array('http' => array(
'method' => 'GET',
));
$config= stream_context_create($options);
$config_final=file_get_contents_curl($al['url'],false, $config);
preg_match_all("|<div class=\"hora\">(.*)</div>|sU", $config_final, $tiempo);
echo $tiempo[1][0];
?></td>
</tr>
<tr>
<?php }?>