I am creating a web scraper using Laravel 3 and have a queue system resque.
Question: Where should I put the logic scrambling code?
In the working / working class?
In a library class that is statically set by the employee / job class?
In the controller function and is the working class / work class of the controller function running?
I am currently using it as a controller function, so I can verify it by going to its URL. It also allows you to perform recurring tasks using Cron, as it resquedoes not allow you to perform recurring tasks. I still need to keep this simple way to test the functions of the scrapers.
Try: . What am I thinking about, how will you organize your code for such purposes?
Working class
class ScraperWorker
{
public function perform()
{
$url = $this->args['url']
Scraper::do_scrape($url);
}
}
Scraping class
class Scraper
{
public static function do_scrape($url) {
}
}
Controller class
For quick testing and for Cron jobs, click
class Scraper_Controller extends Base_Controller {
public function test_scrape($url) {
Scraper::do_scrape($url);
}
}
source
share