[PHP] How do I pass parameters to the getContacts function ?

Highlighted
Member

[PHP] How do I pass parameters to the getContacts function ?

Hi there, 

I am a newcomer to PHP development and I was wondering how I could define the limit and status parameters of the getContacts function using your PHP Wrapper from GitHub. I have the function working but without any parameters. I don't understand how to create the $params array that withholds these parameters. A code snippet would be nice.

Thank you for your answer !

1 REPLY 1
CTCT Employee

Re: [PHP] How do I pass parameters to the getContacts function ?

Hello,

In the wrapper, the params are set as an associative array (or a hash), which will allow you to specify more than one of them. This is done as key and value pairs, with the key being 'limit', 'status', or any other parameter and the value will be the specified value. The code to set these is as follows:

 

$params = array (
'limit' => 500,
'status' => 'ACTIVE');

 

More informatoin about the parameters that can be set can be found at:

 

http://developer.constantcontact.com/docs/contacts-api/contacts-collection.html

 

When this is passed to the getContacts method, it will act within the confines of these parameters.

 

Thank you,
Josh Kirch
Web Services

Developer Portal

View API documentation, code samples, get your API key.