遠端打google得website screenshot

https://gist.github.com/jaseclamp/d4ac6205db352e822ff6  參考這篇

<?php
$sites = "http://shopping.friday.tw/
http://www.kvm.com.au/
http://www.ambertech.com.au/";

$sites = preg_split('/\r\n|\r|\n/', $sites);


echo "
<style>
img {float: left; margin: 15px; }
</style>
";

foreach($sites as $site)
{
    //cache it

        $image = file_get_contents("https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url=$site&screenshot=true&strategy=mobile");
        $image = json_decode($image, true);

        //echo "<pre>"; print_r($image); die;

        $image = $image['screenshot']['data'];


    $image = str_replace(array('_','-'),array('/','+'),$image);

    echo "<img src=\"data:image/jpeg;base64,".$image."\" border='1' />";
?>
Previous
Next Post »