我正在寻找在多个网站上搜索单个数据。数据已正确提取,但仅显示最后一个搜索案例。单个搜索工作正常。
例如,我做了三个搜索,只显示第三个结果——其余的都是空白的。
任何人都可以解释一下吗?
if($_POST)
{
$domains = explode("\n", $_POST[domains]);
foreach($domains as $domain)
{
$domain = explode('|', $domain);
$domain = str_replace(array('http://','/'),'',$domain[0]);
echo '<b>Providing Data for '. $domain .'.. </br></br>';
unset($urls);
unset($url);
unset($blacklinka[1]);
unset($blacklinka);
unset($AskApache_result);
unset($regex);
$domainshort = str_replace('www.','',$domain);
$domainshortdash = str_replace('.','-',$domainshort);
$urls[] = 'http://data.alexa.com/data?cli=10&dat=snbamz&url=' . $domain;
$ch = curl_init();
foreach($urls as $url)
{
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_REFERER, 'http://www.google.com/');
$AskApache_result = curl_exec ($ch);
$regex = '/LINKSIN NUM="(.+?)"/';
preg_match($regex,$AskApache_result,$blacklinka);
echo '</br>';
echo 'Indexed Backlinks: '. $blacklinka[1];
echo '</br></br>';
flush();
ob_flush();
}
}
}