SHARE
TWEET

Geotest

BakerMan Mar 13th, 2014 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter( 'the_content', 'geocode_test' );
  2.  
  3. function geocode_test( $content ) {
  4.         if ( ! isset($_GET['geotest'] ) ) return $content;
  5.         remove_filter( 'the_content', 'geocode_test' );
  6.  
  7.         $test_address = '3100 Central Ave  (at Fountain) ALAMEDA  CA CA  United Statese';
  8.         $url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode( $test_address ) . '&sensor=false';
  9.  
  10.         $result = wp_remote_get($url);
  11.  
  12.         ob_start();
  13.         var_dump( $result );
  14.         $result = ob_get_clean();
  15.  
  16.         return '<pre>' . $result . '</pre>' . $content;
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top