如何用SendindBlue的API获取所有合同?

问题描述 投票:0回答:1

Number of ...

$limit = 500; // int | Number of documents per page
$offset = 0; // int | Index of the first document of the page


try {
    $result = $apiInstance->getContactsFromList($listId, $modifiedSince, $limit, $offset);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactsApi->getContactsFromList: ', $e->getMessage(), PHP_EOL;
}
I think this is what you need, basically it reads the data in chunks (specified by
php api loops foreach each
1个回答
0
投票

will work. 但是他们每页有500个联系人的限制,而我有5000个。我怎么能用偏移量循环?$limit

$limit = 500; // int | Number of documents per page
$offset = 0; // int | Index of the first document of the page

try {
    do {
        $result = $apiInstance->getContactsFromList($listId, $modifiedSince, $limit, $offset);
        // How much data has been passed back, 
        $received = count($result);
        // Just to see each page being received
        echo $received.PHP_EOL;
        // Move offset on by entries in this page
        $offset += $received;
    }
    // Carry on while a full page has been retrieved
    while ($received == $limit);
} catch (Exception $e) {
    echo 'Exception when calling ContactsApi->getContactsFromList: ', $e->getMessage(), PHP_EOL;
}

$received = count($result);

我得到的合同属于某个列表,并使用下面的代码,但他们每页有500个联系人的限制,而我有5000个。但他们每页有500个联系人的限制,而我有5000个。我怎么能用偏移量循环?$limit = 500; / int

© www.soinside.com 2019 - 2024. All rights reserved.