Skip to content

Instantly share code, notes, and snippets.

@zhongdeliu
Created May 31, 2016 08:23
Show Gist options
  • Save zhongdeliu/6f11c7a8bb4478f2c3b7f3c4f7290b43 to your computer and use it in GitHub Desktop.
Save zhongdeliu/6f11c7a8bb4478f2c3b7f3c4f7290b43 to your computer and use it in GitHub Desktop.
<?php
require 'vendor/autoload.php';
use Goutte\Client;
use GuzzleHttp\Client as GuzzleClient;
$client = new Client();
$guzzleClient = new GuzzleClient(array(
'verify' => false,
));
$client->setClient($guzzleClient);
$crawler = $client->request('GET', 'https://localhost/');
// Get the latest post in this category and display the titles
$srcs = array_filter($crawler->filter('img')->extract(array('src')), function($value) {
return !preg_match('/data:image.+base64/i', $value);
});
//file_put_contents(basename($srcs[0]), file_get_contents($srcs[0]));
var_dump($srcs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment