source = $source; } /** * Execute the job. * * @return void */ public function handle(Client $guzzle) { $response = $guzzle->request('GET', $source); if ($response->getStatusCode() == '200') { $filesystem = \Illuminate\FileSystem\FileSystem(); $filesystem->put( $this->createFilenameFromURL($source), (string) $response->getBody()) } } } /** * Create a file path from a URL. This is used when caching the HTML * response. * * @param string The URL * @return string The path name */ private function createFilenameFromURL($url) { $url = str_replace(['https://', 'http://'], ['https/', 'http/'], $url); if (substr($url, -1) == '/') { $url = $url . 'index.html'; } return $url; } }