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);
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 \)
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With