JSFiddle - React, Tailwind, and code Playground

by taylorbuley

HTML

<?php

$addresses = <<<EOF
36 W. 73rd St., New York, NY 10023
300 Berry St., San Francisco, CA 94158
3939 Baltimore Ave., Philadelphia, PA 19104
EOF;

$service = "http://maps.google.com/maps/geo?q=XXX&output=json";

$lines = explode( "\n", $addresses );
foreach ( $lines as $line ) {
	$request = str_replace( "XXX", urlencode( $line ), $service );
	$raw = file_get_contents( $request );
	$json = json_decode( $raw );
	foreach( $json->Placemark as $placemark ) {
		$coords = $placemark->Point->coordinates;
		$lat = $coords[ 0 ];
		$lng = $coords[ 1 ];
		echo "\"$line\", $lat, $lng\n";

	}
}