Consumption of API with multiple requisitions

0

Good morning!

I need to make multiple requests in a REST API, using PHP, passing multiple parameters. I'm currently using% ur_% using a variable in the url.

However, due to the processing time, the Fatal error: Maximum execution time of 30 seconds exceeded error is returned.

I have tried to increase foreach , max_execution_time and max_input_time , it worked for a while, but when the requests increase and I need to increase the values of the parameters again, p>

I would like to know if there are possibilities to do it more efficiently, I now do the following:

EX: I have a list of zip codes and I need to check the API to find out about them and return them in a list.

foreach($registros -> result() as $consulta):
  $url = "https://webmaniabr.com/api/1/cep/{$consulta->cep}";
  $json = file_get_contents($url);
  $result = json_decode($json);
endforeach;
    
asked by anonymous 08.01.2018 / 13:23

0 answers