Hello,
My script downloads and checks content of file, but i have a problem.
Everything works fine if i run the script by myselft (go to the page via browser). However, i need that it would be done by cronjobs and then something doesn't work. Script stops (just returns FALSE) at preg_match function even subject is the same as always.
Here is the error message which i get to email:
/bin/sh: line 1: 9023 Segmentation fault /usr/bin/php -f /home/user/public_html/folder/script.php >/dev/null
My script:
<?php
function GetData($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
// Everything is ok here
$output = GetData('http://www.site.com/content.php');
// $data returns always FALSE when running by cronjobs
$data = (preg_match('/<tbody>(.*?)<\/tbody>/ims', $output, $data)) ? $data[1] : FALSE;
?>
I can't understand where is the problem. Do you have any ideas?