Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4141 | Rev 6056 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 4141 Rev 4911
Línea 98... Línea 98...
98
            $timemsg = $timemsg . '';
98
            $timemsg = $timemsg . '';
99
        }
99
        }
100
        return $timemsg;
100
        return $timemsg;
101
    }
101
    }
Línea -... Línea 102...
-
 
102
    
-
 
103
    public static function geoCodeService($key, $address, $address1, $city, $state, $zip)
-
 
104
    {
-
 
105
        
-
 
106
        
-
 
107
        
-
 
108
        $data = [];
-
 
109
        array_push($data, $address);
-
 
110
        array_push($data, $address1);
-
 
111
        array_push($data, $city);
-
 
112
        array_push($data, $state);
-
 
113
        array_push($data, $zip);
-
 
114
            
-
 
115
        $data = array_filter($data, function($value) { return !empty($value); } );
-
 
116
            
-
 
117
        $url = 'https://maps.googleapis.com/maps/api/geocode/json?' . http_build_query(['address' => implode(',', $data), 'key' => $key]);
-
 
118
   
-
 
119
        
-
 
120
        echo 'URL : ' . $url . '<br>';
-
 
121
        
-
 
122
        
-
 
123
        $ch = curl_init();
-
 
124
        curl_setopt($ch, CURLOPT_URL,$url);
-
 
125
        curl_setopt($ch, CURLOPT_POST, false);
-
 
126
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-
 
127
        $response  = curl_exec ($ch);
-
 
128
        curl_close ($ch);
-
 
129
        
-
 
130
        
-
 
131
        $response = json_decode($response, true);
-
 
132
        
-
 
133
        print_r($response); exit;
-
 
134
        
-
 
135
        
-
 
136
        $latitude   = isset($response['results'][0]['geometry']['location']['lat']) ? $response['results'][0]['geometry']['location']['lat'] : 0;
-
 
137
        $longitude  = isset($response['results'][0]['geometry']['location']['lng']) ? $response['results'][0]['geometry']['location']['lng'] : 0;
-
 
138
        
-
 
139
        
-
 
140
        
-
 
141
        
-
 
142
        return ['latitude' => $latitude, 'longitude' => $longitude];
Línea 102... Línea 143...
102
    
143
    }
103
    
144
    
104
    /**
145
    /**
105
     * 
146
     *