Thursday, June 13, 2024
Google Map ApiPhp

How to get the latitude and longitude using curl php?

get the latitude and longitude using curl php

Hello, welcome to In this post, I will tell you,  How to get the latitude and longitude using curl php? I personally like php ver much. PHP is the best web language. There are many cms and frameworks in PHP and WordPress is the best example. facebook also used PHPin it.

Today, we will get lat-long with the help of php curl function.


Here is the working code  and you have to enable curl on your system if it will not work:
  $details_url = "";
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $details_url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  $geoloc = json_decode(curl_exec($ch), true);
  switch ($geoloc[‘status’]) {
    case 'ZERO_RESULTS':
      return 0;
    case 'OK':

 There are so many code in PHP and i will let you know all. Please do comment if you any query related to this post. Thank you.

the authortherichpost
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

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