Hi, I'm a beginner in php
I have this problem:
I need to add up the total value of each sale of a json, but it is divided into pages! therefore, I need to add the total sales of each page
Example:
-In page 1: I have 100 orders, each one costing 10 reais, in the total of this page I will have a value of 1000.
-No 2 page: I have 50 orders costing 10 reais, so in the total of this page 500 reais
Now I need to add the total of these two pages
** This is the URL of the API. **
$ url = 'https://bling.com.br/Api/v2/pedidos/page=1/'. $ outputType. '/?' . $ dataEmissao;
This is the rest of the code
$ return = executeGetOrder ($ url, $ apikey);
$ obj = json_decode ($ return);
$ subItem = $ obj-> return-> orders;
$ total = 0;
para ($ i = 0; $ i <count ($ subItem); $ i ++) {
$ total + = $ subitem [$ i] -> ordens-> totalVenda;
}
With this code, I can add the sales totals for each page, but I need to add the total of all the pages.
Important to remember that each page shows only 100 requests, sometimes I have the first page with 100 requests and the second page with 58