这是非常基本的,我敢肯定,但我没有使用过PHP,因此发现它很难,我使用的代码给了我一个错误,我不确定我能做什么解决它PHP代码中的错误
<?php
$query = 'dogs';
$searches = 100; // number of results
$start = 0;
$pos = 1;
while($start < $searches)
{
$data = getPage('http://www.google.com/search?start=' . $start . '&q=' . urlencode($query));
preg_match_all("/\<li class\=g\>\<h3 class\=\"r\"\>\<a href\=\"([^\<\>]*)\" class\=l\>/",$data,$matches);
for($x = 0; $x < count($matches[1]); $x++)
{
echo '<p>' . $pos . ' ' . ($matches[1][$x]) . '</p>';
$pos++;
}
$start += 10;
}
?>
错误: 呼叫到第11行
任何帮助未定义功能GETPAGE()?
你有'getPage()'定义的任何地方吗?它是否在您忘记包含的另一个文件中? – PureForm