这是非常基本的我确定,但我没有使用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;
}
?>
Run Code Online (Sandbox Code Playgroud)
错误:在第11行调用未定义函数getPage()
有帮助吗?