<?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' />"; ?>
訂閱部落格