אוקייף הסרתי את שתי הפוקנציות האלה..
גם עכשיו, שגיאה.
PHP קוד:
function get_source_code($url)
{
$ch = curl_init();
$useragent="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$source_code = curl_exec($ch);
curl_close($ch);
$source_code = $source_code;
return $source_code;
}
$s_c = get_source_code('http://www.blabla.com');
$start = '<li class="menu"><a href="#">';
$end = '</a>';
preg_match('/'.preg_quote($start).'(.*?)'.preg_quote($end).'/is', $s_c, $match);
echo $match[1];
הstart וend מופיעים ככה בקוד מקור, אני מנסה לקבל את מה שבניהם.
עכשיו אני מקבל:
PHP קוד:
Warning: preg_match(): Unknown modifier 'a' in D:wampwwwcurl.php on line 24
תודה רבה!