serp-spider / core

:spider: The PHP SERP Spider - A search engine scraper
https://serp-spider.github.io/
Other
89 stars 44 forks source link

Error: Catchable fatal error: Argument 1 passed to Serps\SearchEngine\Google\GoogleClient::__construct() must be an instance of Serps\Core\Browser\BrowserInterface, instance of Serps\HttpClient\CurlClient given #33

Closed mozgbrasil closed 6 years ago

mozgbrasil commented 6 years ago

Hello good afternoon

Error: Catchable fatal error: Argument 1 passed to Serps\SearchEngine\Google\GoogleClient::__construct() must be an instance of Serps\Core\Browser\BrowserInterface, instance of Serps\HttpClient\CurlClient given

Following the example you provided in

https://serp-spider.github.io/documentation/overview/

If I use the following script

use Serps\SearchEngine\Google\GoogleClient;
use Serps\HttpClient\CurlClient;

$googleUrl = 'https://www.google.com.br/';
$proxy = '';

$googleClient = new GoogleClient(new CurlClient());

$googleClient->query($googleUrl, $proxy);

dump($googleClient);

and the following error is returned

Catchable fatal error: Argument 1 passed to Serps\SearchEngine\Google\GoogleClient::__construct() must be an instance of Serps\Core\Browser\BrowserInterface, instance of Serps\HttpClient\CurlClient given, called in /home/marcio/dados/public_html/git/manual/google-appengine/index.php on line 20 and defined in /home/marcio/dados/public_html/git/manual/google-appengine/vendor/serps/search-engine-google/src/GoogleClient.php on line 33

If I use the following script

use Serps\SearchEngine\Google\GoogleClient;
use Serps\HttpClient\CurlClient;

$googleUrl = 'https://www.google.com.br/';
$proxy = '';

$googleClient = new GoogleClient();

$googleClient->query($googleUrl, $proxy);

dump($googleClient);

the following error is returned

Catchable fatal error: Argument 1 passed to Serps\SearchEngine\Google\GoogleClient::query() must be an instance of Serps\SearchEngine\Google\GoogleUrlInterface, string given, called in /home/marcio/dados/public_html/git/manual/google-appengine/index.php on line 22 and defined in /home/marcio/dados/public_html/git/manual/google-appengine/vendor/serps/search-engine-google/src/GoogleClient.php on line 48
mozgbrasil commented 6 years ago

I was able to do the simulation based on the following example

https://serp-spider.github.io/documentation/search-engine/google/

gsouf commented 6 years ago

Hi @mozgbrasil

Indeed the intructions on the first link are outdated. I re-open the issue until I fix it.

Thanks for figuring the out this issue.

gsouf commented 6 years ago

Documentation is now fixed.