title: screenshot using googlepagespeed api
body: <p>Below is my code to capture the screenshot of of webpage. But i get the output of the same as how in the image below. Kindly suggest on what is the mistake i am committing. Also kindly suggest the method to save this screenshot to the server?</p>
  
  <p><a href="https://i.stack.imgur.com/QsYlN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QsYlN.png" alt="enter image description here"></a> </p>
  
  <pre><code>&lt;?php
   $url='https://www.google.com';
   $stratedy = 'mobile' ;
   $apiReqUrl = 'https://www.googleapis.com/pagespeedonline/v2/runPagespeed';
   $apiKey = 'my_api_key' ;
   $curl = curl_init();
   curl_setopt($curl, CURL_OPTURL, $apiReqUrl.'?url='.$reqUrl.' 
   &amp;key='.$apiKey.'&amp;screenshot=true&amp;strategy='.$stratedy);
   curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
   $result=curl_exec($curl);
   $data = json_decode($result, true);
   $img = str_replace(array('_','-'), array('/','+'), $data['screenshot'] 
   ['data']);
   echo '&lt;img src="data:image/jpeg;base64,'.$img.'"&gt;';
   ?&gt;
  </code></pre>