How do I get ALL Subscriber data? (name, email, phone)

Hi,

I'm wondering which api method do we use to pull all of the subscriber data from a list.

Here's the process we're looking to do:

1. First pull the available lists of client
2. Pull data (name, email, phone) of from list

Thanks,

Chris

jamesd jamesd, 7 years ago

Hi Chris,

1. Client.GetLists
2. Subscribers.GetActive

That should allow you to achieve what you're trying to do.

ciclista, 7 years ago

Is a PHP Code available for it?
The Package at google Code doesn't contain any Code for it.

jamesd jamesd, 7 years ago

I think you will find that the PHP wrapper available at http://code.google.com/p/campaignmonitor-php/ *does* contain wrappers for those API methods:

http://code.google.com/p/campaignmonitor-php/source/browse/trunk/CMBase.php#1023
http://code.google.com/p/campaignmonitor-php/source/browse/trunk/CMBase.php#323

ciclista, 7 years ago

Thanks James!

with

print_r($cm->subscribersGetActive());

i am getting the Subscribers.

Sorry the next Question, but how can i echo them within a foreach() Loop?

Thanks!

Joomailer Joomailer, 7 years ago

Hi,
This is how you could do it:

        $cm   = new CampaignMonitor( $api_key  );
        $list_id = 1234;
        $subs = $cm->subscribersGetActive(0, $list_id);

        // make sure the array looks the same with one entry and with several entries
        if ( !$subs['anyType']['Subscriber'][0] ) {
            $data = $subs['anyType']['Subscriber'];
            $subs['anyType']['Subscriber'] = '';
            $subs['anyType']['Subscriber'][0] = $data;
        }

        foreach ( $subs['anyType']['Subscriber'] as $sub ) {
            echo 'Email: '.$sub['EmailAddress'];
            echo ', Name: '.$sub['Name'];
            echo ', Subscription date: '.$sub['Date'];
            echo ', State: '.$sub['State'];
            echo'<br />';
        }

Cheers,
Pete


-----------------------------------------------------------------------------------
Joomailer.com - Campaign Monitor Integration for Joomla!
-----------------------------------------------------------------------------------
ciclista, 7 years ago

Pretty Cool, thanks!

200,000 companies around the world can't be wrong.

From Australia to Zimbabwe, and everywhere in between, companies count on 
Campaign Monitor for email campaigns that drive real business results.

Get started for free
1-888-533-8098