Skip to main content

Find a Pinpoint on map using Google Map url



Find a Pinpoint on map using Google Map url 


<?php

$email  = 'https://www.google.co.in/maps/place/Tour+Eiffel,+5+Avenue+Anatole+France,+75007+Paris,+France/@48.8582641,2.2923184,17z/data=!3m1!4b1!4m2!3m1!1s0x47e66fe1f3bfb4ad:0x7bd31375becf28cd';

if(isset($_POST['get_location']))
{
$email = $_POST['location_url'];
}

$domain = strstr($email, '@');
echo $domain; 
echo "<br/>";
echo "<br/>";
echo strpbrk($domain, '@');
echo "<br/>";
$keywords = preg_split("/[\s,@]+/", $domain);
extract($keywords);
echo $keywords[0] ;
echo "<br/>";
echo $keywords[1] ;
echo "<br/>";
echo $keywords[2];
echo "<br/>";
$zoom = $keywords[3];
echo $zoom;
echo "<br/>";
$zoomlevel = substr($zoom, 0, -1);
echo $zoomlevel;

?>
<!DOCTYPE html>
<html>
<head>
<script
src="http://maps.googleapis.com/maps/api/js">
</script>

<script>
var lan  = "<?php echo $keywords[1]; ?>";
  var lang = "<?php echo $keywords[2]; ?>";
  var zoom = "<?php echo $zoomlevel; ?>";
  var zoomlevel =parseInt(zoom); 

var myCenter=new google.maps.LatLng(lan,lang);

function initialize()
{
var mapProp = {
  center:myCenter,
  zoom:zoomlevel,
  mapTypeId:google.maps.MapTypeId.ROADMAP
  };

var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);

var marker=new google.maps.Marker({
  position:myCenter,
  });

marker.setMap(map);
}

google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>

<body>
<form method="post" action="">
<div>
<input type="text" name="location_url">
</div>
<div>
<input type="submit" name="get_location" value="Get Location">
</div>
</form>
<div id="googleMap" style="width:500px;height:380px;"></div>
</body>
</html>

Output:


Comments

Popular posts from this blog

$var = 'PHP Tutorial'. Put this variable into the title section, h3 tag and as an anchor text within a HTML document.

$var = 'PHP Tutorial'. Put this variable into the title section, h3 tag and as an anchor text within a HTML document.  <?php echo "<html>"; echo "<head>"; echo "<title>"; echo "PHP TUTORIAl"; echo "</title>"; echo "<body>"; echo "<h3>PHP TUTORIAL</h3>"; echo "<hr>"; echo "<p>PHP, an acronym for Hypertext Preprocessor, is a widely-used open source general-purpose scripting language. It is a cross-platform, HTML embedded server-side scripting language and is especially suited for web development.</p>"; echo "</body>"; echo "</head>"; echo "</html>"; ?> Output:

Create a simple HTML form and accept the user name and display the name through PHP echo statement.

Create a simple HTML form and accept the user name and display the name through PHP echo statement. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Post Data</title> </head> <body> <form method="POST" action=""> <label>Enter First Name</label> <input type="text" name="firstname" id="firstname" /> <input type="submit" name="submit_button" value="Submit Name" /> </form> </body> </html> <?php if(isset($_POST) && !empty($_POST)) { echo "<h3> Hello ".$_POST['firstname']."</h3>"; } ?> Output:

Write a PHP script, which change the color of first character of a word.

Write a PHP script, which change the color of first character of a word. <?php   $text = 'PHP Tutorial';   $text = preg_replace('/(\b[a-z])/i','<span style="color:red;">\1</span>',$text);   echo $text;   ?>