title: Failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden warning error in staticmap google api
body: <p>I am using below script for showing google map.<br>
  it's working fine but sometimes I am getting a warning message:</p>
  
  <pre><code>&lt;?php
  $src = 'https://maps.googleapis.com/maps/api/staticmap?      center=40.714728,-73.998672&amp;markers=color:red%7Clabel:C%7C40.718217,-73.998284&amp;zoom=12&amp;size=600x400';
      $time = time();
      $desFolder = '';
      $imageName = 'google-map.PNG';
      $imagePath = $desFolder.$imageName;
      file_put_contents($imagePath,file_get_contents($src));
  ?&gt;
  &lt;img src="&lt;?php echo $imagePath; ?&gt;"/&gt;
  </code></pre>
  
  <p>A PHP Error was encountered</p>
  
  <p>Severity: Warning</p>
  
  <blockquote>
    <p>Message:
    file_get_contents(<a href="https://maps.googleapis.com/maps/api/staticmap?center=39.9834656,-75.1499542&amp;15&amp;size=250x250&amp;maptype=hybrid&amp;markers=color:red%7Ccolor:red%7Clabel:A%7C39.9834656,-75.1499542&amp;sensor=true" rel="nofollow noreferrer">https://maps.googleapis.com/maps/api/staticmap?center=39.9834656,-75.1499542&amp;15&amp;size=250x250&amp;maptype=hybrid&amp;markers=color:red%7Ccolor:red%7Clabel:A%7C39.9834656,-75.1499542&amp;sensor=true</a>):
    failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden.</p>
  </blockquote>
  
  <p>Maybe there is security concern with file_get_contents when used multiple times.
  So help me for providing an alternate solution in place of file_get_content or How I can handle this warning.</p>
  
  <p>Thanks for your support in advance.  </p>