PHP代码中的错误

this is extremely basic I'm sure but I haven't used PHP ever and thus finding it hard, a code that I am using is giving me an error and I'm unsure what I can do to fix it

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

Error: Call to undefined function getPage() on line 11

Any help?

There's no getPage(); function in your code and in PHP. You have to have one in order to call/use it.

See file_get_contents(); | fopen();

There is no "getPage" function in PHP (unless you defined it).

It looks like the function file_get_contents() is what your going for.

Is the getPage() function being defined somewhere else that you're not including?

My guess is you want to use file_get_contents() instead.