$terms)); // Request search results: $client = new Goutte\Client; $crawler = $client->request('GET', $url); // See response content: // $response = $client->getResponse(); // $response->getContent(); // Start crawling the search results: $page = 1; $result = null; while (is_null($result) || $page <= $pages) { // If we are moving to another page then click the paging link: if ($page > 1) { $link = $crawler->selectLink($page)->link(); $crawler = $client->click($link); } // Use a CSS filter to select only the result links: $links = $crawler->filter('li.g > h3 > a'); // Search the links for the domain: foreach ($links as $index => $link) { $href = $link->getAttribute('href'); if (strstr($href, $domain)) { $result = ($index + 1) + (($page - 1) * 10); break 2; } } $page++; } } // A simple HTML escape function: function escape($string = '') { return htmlspecialchars($string, ENT_COMPAT, 'UTF-8', false); } ?>
Searching Google for using the terms "".
Result Number:
Page Number: