Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 179 Rev 283
Línea 225... Línea 225...
225
        $response  = curl_exec ($ch);
225
        $response  = curl_exec ($ch);
226
        curl_close ($ch);
226
        curl_close ($ch);
Línea 227... Línea 227...
227
        
227
        
228
        
228
        
229
        $response = json_decode($response, true);
-
 
230
        
-
 
231
        print_r($response); exit;
-
 
232
        
229
        $response = json_decode($response, true);
233
        
230
 
234
        $latitude   = isset($response['results'][0]['geometry']['location']['lat']) ? $response['results'][0]['geometry']['location']['lat'] : 0;
-
 
235
        $longitude  = isset($response['results'][0]['geometry']['location']['lng']) ? $response['results'][0]['geometry']['location']['lng'] : 0;
231
        $latitude   = isset($response['results'][0]['geometry']['location']['lat']) ? $response['results'][0]['geometry']['location']['lat'] : 0;
236
        
-
 
237
        
-
 
238
        
232
        $longitude  = isset($response['results'][0]['geometry']['location']['lng']) ? $response['results'][0]['geometry']['location']['lng'] : 0;
239
        
233
 
Línea 240... Línea 234...
240
        return ['latitude' => $latitude, 'longitude' => $longitude];
234
        return ['latitude' => $latitude, 'longitude' => $longitude];
241
    }
235
    }
Línea 932... Línea 926...
932
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
926
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
933
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
927
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
934
        $response = curl_exec($ch);
928
        $response = curl_exec($ch);
935
        curl_close($ch);
929
        curl_close($ch);
936
        $json = json_decode($response);
930
        $json = json_decode($response);
937
        //print_r($json);
-
 
-
 
931
 
938
        foreach ($json->results as $result) {
932
        foreach ($json->results as $result) {
939
            $address1='';
933
            $address1='';
940
            foreach($result->address_components as $addressPart) 
934
            foreach($result->address_components as $addressPart) 
941
            {
935
            {
942
                if((in_array('locality', $addressPart->types)) && (in_array('political', $addressPart->types))) {
936
                if((in_array('locality', $addressPart->types)) && (in_array('political', $addressPart->types))) {