<?php | |
require_once "./vendor/autoload.php"; | |
$client = new Goutte\Client(); | |
$keywords = "helge sverre"; | |
$crawler = $client->request('GET', 'https://www.google.no/search?q=' . urlencode($keywords)); | |
$position = 1; | |
$results = $crawler->filter("cite")->each(function ($node) use ($position) { | |
if (strpos($node->text(), "helgesverre.com") !== false) { | |
return $node->text(); | |
} else { | |
$position++; | |
} | |
}); | |
var_dump($position); | |
print_r(array_filter($results)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment