Personal how to go through an array with multiple requests?

0

I'm getting this object via API and would need to go through each of those pages, remembering that each page is a requisition. Here in this demo I am on page 1 each page brings me 50 records and the return shows me that there are 39 pages ... how do I go through these 39 pages making a request to each page? Since I am very grateful for the help of all.

Array
(
[retorno] => Array
    (
        [status_processamento] => 3
        [status] => OK
        [pagina] => 1
        [numero_paginas] => 39
        [contas] => Array
            (
                [0] => Array
                    (
                        [conta] => Array
                            (
                                [id] => 504024714
                                [nome_cliente] => IRINEU DOMINGOS ANTUNES
                                [historico] => CONTAS A PAGAR - (Cliente sistema antigo - incluso no SCPC)
                                [numero_banco] => 
                                [numero_doc] => 000022554
                                [serie_doc] => 0
                                [data_vencimento] => 10/12/2014
                                [situacao] => aberto
                                [data_emissao] => 28/11/2017
                                [valor] => 392.66
                                [saldo] => 392.66
                            )

                    )

                [1] => Array
                    (
                        [conta] => Array
                            (
                                [id] => 503982261
                                [nome_cliente] => MARCUS VINICIUS DE OLIVEIRA CUNHA
                                [historico] => Ref. Venda otica self care Elisama
                                [numero_banco] => 
                                [numero_doc] => 000270860
                                [serie_doc] => 0
                                [data_vencimento] => 27/02/2015
                                [situacao] => aberto
                                [data_emissao] => 28/11/2017
                                [valor] => 444.00
                                [saldo] => 444.00
                            )

                    )

                [2] => Array
                    (
                        [conta] => Array
                            (
                                [id] => 503885902
                                [nome_cliente] => LUIZ CARLOS MIRANDA
                                [historico] => CONTAS A RECEBER - PEDIDO 5912 - LUIZ CARLOS MIRANDA - Parcela (1/8)
                                [numero_banco] => 
                                [numero_doc] => 000005912
                                [serie_doc] => 0
                                [data_vencimento] => 14/01/2016
                                [situacao] => aberto
                                [data_emissao] => 27/11/2017
                                [valor] => 125.00
                                [saldo] => 125.00
                            )

                    )

                [3] => Array
                    (
                        [conta] => Array
                            (
                                [id] => 503885904
                                [nome_cliente] => LUIZ CARLOS MIRANDA
                                [historico] => CONTAS A RECEBER - PEDIDO 5912 - LUIZ CARLOS MIRANDA - Parcela (2/8)
                                [numero_banco] => 
                                [numero_doc] => 000021248
                                [serie_doc] => 0
                                [data_vencimento] => 13/02/2016
                                [situacao] => aberto
                                [data_emissao] => 27/11/2017
                                [valor] => 125.00
                                [saldo] => 125.00
                            )

                    )

                [4] => Array
                    (
                        [conta] => Array
                            (
                                [id] => 503991231
                                [nome_cliente] => WELLIGTON RODRIGO RIBEIRO DA SILVA
                                [historico] => CONTAS A RECEBER - PEDIDO 1452 - WELLIGTON RODRIGO RIBEIRO DA SILVA - Parcela (1/10)
                                [numero_banco] => 
                                [numero_doc] => 000001452
                                [serie_doc] => 0
                                [data_vencimento] => 13/02/2016
                                [situacao] => aberto
                                [data_emissao] => 28/11/2017
                                [valor] => 30.00
                                [saldo] => 30.00
                            )

                    )
    
asked by anonymous 14.12.2017 / 16:10

1 answer

1

Run a foreach at each level of the array.

foreach($retornoDaAPI['retorno'] as $key => $value){
    foreach($value['contas'] as $key2 => $value2){
       //e assim sucessivamente
    }
}
    
14.12.2017 / 16:24