Consultation of very slow cep

Asked

Viewed 76 times

0

date_default_timezone_set('America/Sao_Paulo');
include 'conn.php';
    $query = $mysql_adv->query("SELECT * FROM dados");
    while($row = $query->fetch_array()){
        $url  = "https://maps.googleapis.com/maps/api/distancematrix/json?origins=";
        $url .= $row['cep_adv']."&destinations=".$_GET['cep'];
        $url .= "&language=pt&mode=car&key=AIzaSyDL6_dJ-Mbi_03_g6lHhWibxY22Z2UeYZQ";
        $json = file_get_contents($url);
        $json_data = json_decode($json, true);
    } 

I am making an appointment with 30 ceps and this very slow loading! about 1 minute, what can I do?

  • Explain how it works better. Are you using the Google API? What should happen? What have you tried? etc...

1 answer

1

As long as you are using a public service, there is not much to do but acquire a private service or have your own zip code database.

The Google site receives many requests, possibly they do not provide many computational resources for open services like this cep query.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.