Created
May 31, 2016 08:23
-
-
Save zhongdeliu/6f11c7a8bb4478f2c3b7f3c4f7290b43 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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