I'm pretty new to OOP, so please have mercy ;( . I am not even shure if the title of this post is ok.
I'm crawling some sites with Goutte
, like this
$ad['title'] = $crawler->filter('#subject')->text();
$ad['image'] = $crawler->filter('.images')->filter('meta')->eq(0)->attr('content');
This is not too difficult, but i want to have reusable code. So for every site I scrape there is an $ad['title']
and an $ad['image']
The used $crawler methods differ per site, so I would like to have something like
$crawler->$filter
Where filter contains
'filter('#subject')->text()'
That way I can store the filters in the database per site. I don't know if this is possible of even is a good approach.