/** * @param string $query * @param int $pageNum * @return array */ public static function searchFromNet($query = "", $pageNum = 1) { if (empty($query)) { return []; } $url = Config::get('maltapark.url') . Config::get('maltapark.pageSearch') . $query . Config::get('maltapark.pageNum') . $pageNum; $content = Helpers\FakeBrowser::get($url); $items = []; $crawler = new Crawler(null, $url); $crawler->addContent($content, "text/html"); foreach ($crawler->filter('#item_list') as $node) { $item = new ListItem(Helpers\Dom::getHtml($node)); $items[] = $item; } return $items; }
/** * @param int $pageNum * @return string */ public static function getJobs($pageNum = 1) { return FakeBrowser::get(Config::get('keepmeposted.url') . Config::get('keepmeposted.jobsApi') . Config::get('keepmeposted.pageNum') . $pageNum . Config::get('keepmeposted.fixedCategories')); }
private function searchContactPage($website) { $contactPages = ['/contact', '/contact.php', '/contactus', '/contacts', '/en/contacts', '/contact-us', '/en/contact-us.htm', '/about']; set_error_handler(create_function('$severity, $message, $file, $line', 'throw new ErrorException($message, $severity, $severity, $file, $line);')); foreach ($contactPages as $contact) { $html = null; try { $html = FakeBrowser::get($website . $contact); } catch (\Exception $e) { echo "\t contact page not {$contact}\n"; } if ($html !== null) { restore_error_handler(); return $html; } } restore_error_handler(); return false; }