title: How to do I output just the formatted_address from a google api search?
body: <p>I am trying just to output the formatted-address for the input hotels in ottawa. The results give me all the data i need plus unwanted stuff. i need to truncate this. any ideas? </p>
  
  <pre><code>     $address = urlencode("Hotels, in Ottawa");
  
       $geocodeURL = "https://maps.googleapis.com/maps/api/place/textsearch/json?query=hotels+in+Ottawa&amp;sensor=false&amp;key=mykey";
       $ch = curl_init($geocodeURL);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
       $result = curl_exec($ch);
       $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
       curl_close($ch);
  
       $geocode = json_decode($result);
  
       echo $result;
  
       //echo $formatted_address = $geocode-&gt;data[0]-&gt;formatted_address;
  </code></pre>