Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No ending delimiter '/' found error

I have adjusted a small script to check backlinks. Yet I keep on getting the error

Warning: preg_match() [function.preg-match]: No ending delimiter '/' found in line 17.

<?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;
}

function google_backlink($uri)
{
$url = 'http://www.google.com/search?q=link:facebook.com&hl=en&filter=0';
$v = file_get_contents_curl($url);
preg_match('/<div id="resultStats">About \(.*?)\ ',$v,$s);
$s_number = explode(".", $s[1]);
$i = 0;
if ($s[1]!=0) {
    return $s[1];
} else {
    return ($r[1]) ? $r[1] : '0';
}
}

echo "Google backlink = ".google_backlink($url)."<br />";   
?>

What is wrong with preg_match('/<div id="resultStats">About \(.*?)\ ',$v,$s);

like image 700
Lisa Avatar asked Nov 30 '22 16:11

Lisa


1 Answers

The error is very clear really, you didn't include the trailing /:

preg_match('/<div id="resultStats">About \(.*?)\ /',$v,$s);

I honestly doubt your escape characters are well placed though. Maybe you meant \)?

like image 146
Blindy Avatar answered Dec 06 '22 07:12

Blindy