Back to Top

How to get Latitude and longitude using address?

To get Latitude and longitude using address

Here, I am going to explain function which will return latitude and longitude value by passing address.

Google map provides great functionality to get latitude or longitude values using an address or you can get an address using latitude and longitude values.

Here I have called Google API and have passed address into URL. Before passing address into URL , I have encoded it with urlencode function.

Next, I have called cURL which is used to get data or response from another server in PHP and you will get latitude and longitude values and use it whenever you want.

I have used the following code into WordPress but you can use code into any of your PHP coding structure with some modification.

After reading all this paragraphs, now it’s time for checking code.

So let’s understand following code:

I hope you get this function and if you have any query, post your comments below. You can modify this function as per your requirement and use it.

Also Read:

Fetch Twitter data with cURL
To read JSON data with jQuery

Hope this article helps someone.As always, thanks for reading. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How to use MySQL Event Scheduler

Posted on 1 year ago

Bhumi

How to Use the HTML5 Full-Screen API

Posted on 1 year ago

Bhumi

How to Detect the Orientation of Ipad

Posted on 6 years ago

Bhumi

How to get Last Post in WordPress

Posted on 6 years ago

Bhumi