title: Google Geocode API different results
body: <p>I have a somewhat strange problem.
  I'm working on a project and need to know the distance between 2 locations in my php script.
  You can give the google api the city name or the zipcode.</p>
  <p>Hey should be easy right? Wrong!</p>
  <p>I tried to test it of course with known zipcodes and my city.
  'Hannover' and '30159' the distance should be somewhat around 0 but strangly I got over 7200km. (My code to calculate distances between 2 coords works believe me)</p>
  <p><strong>Now to the actual problem.</strong></p>
  <p>My steps:</p>
  <ol>
  <li>var_dump the result of the api request</li>
  <li>echo url for api request</li>
  <li>open url in browser and compare output</li>
  </ol>
  <p>Here is my very simple code for that.</p>
  <pre><code>$url = &quot;https://maps.googleapis.com/maps/api/geocode/json?&amp;address=&quot;.urlencode($ort).&quot;&amp;key=$google_api_key&quot;;
  echo $url.&quot;&lt;hr&gt;&quot;;
  $string = file_get_contents($url);
  echo $string.&quot;&lt;hr&gt;&quot;;
  </code></pre>
  <p>This is now strange. The output is totally different in the browser when compared to the php script.</p>
  <p><a href="https://i.stack.imgur.com/bEtJg.png" rel="nofollow noreferrer">output compared browser vs script (sry I have no formatting for the script output)</a></p>
  <p>Is anyone able to explain to me and/or offer solution to make the output of the script like the &quot;desired&quot; output of the browser with the zipcode 30159 located inside germany?</p>
  <p>Cheers Nexarius</p>