Closed wadleo closed 7 years ago
I will run another test with the specified version in the evening.
Cool.
On May 18, 2017 9:43 AM, "Daniel Weidner" notifications@github.com wrote:
I will run another test with the specified version in the evening.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dweidner/laravel-goutte/issues/14#issuecomment-302340536, or mute the thread https://github.com/notifications/unsubscribe-auth/AKfxRHkfnNq78y8vgp3yW3tJAL6mMrnmks5r7ASxgaJpZM4Nevsx .
Ok I found a tutorial and I followed their example of using Goutte\Client and using the client object to crawl the website here is the snipet <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request; use \Goutte\Client;
class MyController extends Controller { //
public function index() {
$client = new Client();
$crawler = $client->request('GET', 'https://duckduckgo.com/html/?q=Laravel');
$crawler->filter('.result__title .result__a')->each(function ($node) {
dump($node->text());
});
return view('home');
}
}
Updating your readme, would save the us a lot of stress
ok cool
ohhhh snap @wadleo @dweidner I think this fixes it for me:
use Goutte\Client as Goutte;
...
/**
* @param $endpoint array
* @return bool
*/
public function scrape($endpoint)
{
$crawler = (new Goutte)->request('GET', 'https://boards.greenhouse.io/' . $endpoint['endpoint']);
$crawler->filter('.opening')->each(function ($node) use ($endpoint) {
$jobListing = new JobListing;
$jobListing->title = $node->filter('a')->text();
$jobListing->url = $node->filter('a')->attr('href');
$jobListing->city = $node->filter('.location')->text();
$jobListing->company_id = $endpoint['company_id'];
$jobListing->active = true;
$jobListing->save();
$this->info('Added job listing: ' . $jobListing->title . ' for ' . $endpoint['name'] . "\n");
});
return true;
}
nvm, ended up with error: Class 'Goutte\Client' not found
on production
Hello @dweidner is this package compactible with laravel 5.4 because I have the same problem as in #12 and can revert back to a lower version. I'm eagerly waiting for your response, thanks.
Best regards, wadleo.