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 change Quotes in WordPress

Posted on 12 years ago

Bhumi

Learn React JS with simple Application

Posted on 8 years ago

Bhumi