This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function distance($lat1, $lon1, $lat2, $lon2, $unit) { | |
| if (($lat1 == $lat2) && ($lon1 == $lon2)) { | |
| return 0; | |
| } | |
| else { | |
| $theta = $lon1 - $lon2; | |
| $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); | |
| $dist = acos($dist); | |
| $dist = rad2deg($dist); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $apiKey = 'Enter_API_Key'; | |
| $params['format'] = 'json'; | |
| $params['country_code'] = 'US'; | |
| $query = ''; | |
| foreach($params as $key=>$value){ | |
| $query .= '&' . $key . '=' . rawurlencode($value); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Country-Region DropDown Menu</title> | |
| <!-- link for jquery style --> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> | |
| <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Please refer to https://geodatasource.com/web-service/location-search for the full sample codes and API key | |
| <?php | |
| $apiKey = 'Enter_API_Key'; | |
| $params['format'] = 'json'; | |
| $params['lat'] = 37.3861; | |
| $params['lng'] = -122.084; | |
| $query = ''; |