0
저는 XeroOAuth-PHP SDK를 사용하고 있으며 전용 애플리케이션 용 인보이스를 다운로드하려고합니다. - 지금까지 100 가지 인보이스의 첫 번째 배치를 인증하고 다운로드하는 것이 좋습니다.XeroOAuth-PHP - 페이지 네이션 예제
지금은 한 번에 100 송장 그룹을 다운로드하는 페이지 매김 포함하도록 코드를 확장하기 위해 찾고 있어요- 내가 사용하여 각 요청에 대한 송장의 수를 얻을 수있는 방법 :
$totalInvoices = count($invoices->Invoices[0]);
을하지만 확실하지를 1 페이지에서 시작하는 루프를 추가하고 인보이스 수가 100보다 작을 때까지 계속 하시겠습니까?
$response = $XeroOAuth->request('GET', $XeroOAuth->url('Invoices', 'core'), array('where' => 'Type=="ACCREC"'));
나는이 라인을 따라 뭔가를 찾고 있어요 : 여기
는 처음 100 미수금 송장을 가져옵니다 요청의// set pagiation to page 1
$page = 1;
// start a loop for the $page counter
// download first page of invoices (first 100) - not sure how to specify page 1 here
$response = $XeroOAuth->request('GET', $XeroOAuth->url('Invoices', 'core'), array('where' => 'Type=="ACCREC"', 'page' => $page));
if ($XeroOAuth->response['code'] == 200) {
// Get total found invoices
$totalInvoices = count($invoices->Invoices[0]);
// Parse Invoices
$invoices = $XeroOAuth->parseResponse($XeroOAuth->response['response'], $XeroOAuth->response['format']);
// Loop through each invoice
$recnum = 1;
foreach($invoices as $invoice){
// Do Stuff
pr($invoices->Invoices[$recnum]->Invoice);
$recnum++;
}
} else {
outputError($XeroOAuth);
}
// Exit once $totalInvoices < 100
$page++;