public function filter(Request $data) { preg_match($this->__regexp, $data->getResponseText(), $match); return !empty($match[1]) ? $match[1] : NULL; }
/** * The RollingCurl callback function * * @param Request $request The request object * @param RollingCurl $rolling_curl The current RollingCurl object * @return void */ public function theCallback(Request $request, RollingCurl $rollingCurl) { // dd($request->getResponseInfo()); $url = $request->getUrl(); $html = $request->getResponseText(); $httpCode = array_get($request->getResponseInfo(), 'http_code'); // Add URL to index (or update count) $this->getWebCache()->add($url); if ($httpCode >= 200 && $httpCode < 400 && !empty($html)) { $matches = []; // Parse - Links $this->getParser()->parseLinks($request, $rollingCurl); // Parse - Emails // $this->parseEmails($html); // Garbage collect unset($html); } $this->crawlUrls(); // dd($this->getWebCache()->all()); // return $newLinks; }