PHP code example of arraypress / wp-mapsco-geocoding

1. Go to this page and download the library: Download arraypress/wp-mapsco-geocoding library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

arraypress / wp-mapsco-geocoding example snippets


use ArrayPress\MapsCo\Geocoding\Client;

$client = new Client( $api_key );
$result = $client->geocode( 'Buckingham Palace, London' );

if ( ! is_wp_error( $result ) ) {
	update_post_meta( $id, '_lat', $result->get_latitude() );
	update_post_meta( $id, '_lng', $result->get_longitude() );
}

echo esc_url( $result->get_google_maps_url() );