public function getSubscriberEmails($listId)
    {
        $emails = [];
        $members = [];
        $offset=0;
        $maxresult = 200;
        $result = $this->mailchimp->get("lists/$listId/members", ['count'=> $maxresult]);

        if (!$this->mailchimp->success()) {
            $this->throwMailchimpError($this->mailchimp->getLastResponse());
        }

        $totalItems = $result['total_items'];
        $members = array_merge($members, $result['members']);

        while ($offset < $totalItems) {
            $offset+=$maxresult;
            $result = $this->mailchimp->get("lists/$listId/members", [
                        'count'         => $maxresult,
                        'offset'        => $offset
                    ]);

            if (!$this->mailchimp->success()) {
                $this->throwMailchimpError($this->mailchimp->getLastResponse());
            }
            $members = array_merge($members, $result['members']);
        };

        foreach ($members as $key => $member) {
            array_push($emails, $member['email_address']);
        }

        return $emails;
    }
public function getSubscriberEmails($listId)
    {
        $emails = [];
        $members = [];
        $offset=0;
        $maxresult = 200;
        $result = $this->mailchimp->get("lists/$listId/members", ['count'=> $maxresult]);

        if (!$this->mailchimp->success()) {
            $this->throwMailchimpError($this->mailchimp->getLastResponse());
        }

        $totalItems = $result['total_items'];
        $members = array_merge($members, $result['members']);

        while ($offset < $totalItems) {
            $offset+=$maxresult;
            $result = $this->mailchimp->get("lists/$listId/members", [
                        'count'         => $maxresult,
                        'offset'        => $offset
                    ]);

            if (!$this->mailchimp->success()) {
                $this->throwMailchimpError($this->mailchimp->getLastResponse());
            }
            $members = array_merge($members, $result['members']);
        };

        foreach ($members as $key => $member) {
            array_push($emails, $member['email_address']);
        }

        return $emails;
    }
public function getSubscriberEmails ( $ listId ) { $ emails = [ ] ; $ members = [ ] ; $ offset = 0 ; $ maxresult = 200 ; $ result = $ this -> mailchimp -> get ( "lists/$listId/members" , [ 'count' => $ maxresult ] ) ; if ( ! $ this -> mailchimp -> success ( ) ) { $ this -> throwMailchimpError ( $ this -> mailchimp -> getLastResponse ( ) ) ; } $ totalItems = $ result [ 'total_items' ] ; $ members = array_merge ( $ members , $ result [ 'members' ] ) ; while ( $ offset < $ totalItems ) { $ offset += $ maxresult ; $ result = $ this -> mailchimp -> get ( "lists/$listId/members" , [ 'count' => $ maxresult , 'offset' => $ offset ] ) ; if ( ! $ this -> mailchimp -> success ( ) ) { $ this -> throwMailchimpError ( $ this -> mailchimp -> getLastResponse ( ) ) ; } $ members = array_merge ( $ members , $ result [ 'members' ] ) ; } ; foreach ( $ members as $ key => $ member ) { array_push ( $ emails , $ member [ 'email_address' ] ) ; } return $ emails ; }
Get an array of subscribers emails from a list
@param string $listId
@return array
Get an array of subscribers emails from a list