The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Output Subscriber list to a private website

Highlighted
New Member

Output Subscriber list to a private website

Hello, I would like to create a page on my website that displays a particular contact list. This page will be password protected. Is there a pre-written script that accomplishes this? If not, how can I call a Constant Contact database from my website? I have a script that accomplishes the same task but it calls for a database that is on my own server. it looks like this. Am I able to reconfigure this to work with a constant contact database? Thanks!



















$username="luch";
$password="34bErkley2";
$database="berkley";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM theManors";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

echo "
Database Output


";

$i=0;
while ($i < $num) {

$id=mysql_result($result,$i,"id");
$salutation=mysql_result($result,$i,"salutation");
$firstName=mysql_result($result,$i,"firstName");
$lastName=mysql_result($result,$i,"lastName");
$street=mysql_result($result,$i,"street");
$city=mysql_result($result,$i,"city");
$province=mysql_result($result,$i,"province");
$postCode=mysql_result($result,$i,"postCode");
$phone=mysql_result($result,$i,"phone");
$evePhone=mysql_result($result,$i,"evePhone");
$source=mysql_result($result,$i,"source");
$type=mysql_result($result,$i,"type");
$email=mysql_result($result,$i,"email");


echo "














";


$i++;
}

?>


Id Sal. First Name Last Name Street City Province Postal Code Phone (D) Phone (E) Source Type Email
$id $salutation $firstName $lastName $street $city $province $postCode $phone $evePhone $source $type $email
2 REPLIES 2
Highlighted
Employee

Re: Output Subscriber list to a private website

You can certainly output the contents of a contact list through your website. You can obtain general information about a specific list by Retrieving an individual list. If you're looking to display each member of that list (which it sounds like you are), you would want to look at Obtaining subscribers in a contact list. Unfortunately we don't have this exact script written up, but you can get a fair way through what would be needed to implement this by looking at our Code Samples page.


In essence, you're looking to perform an http get on https://api.constantcontact.com/ws/customers/{user-name}/lists/{list-id}/members. Once this information is retrieved you would loop through each returned entry and use that to populate your $firstName, $lastName, $city..etc variables. Be aware that this will only return a maximum of 50 contacts per page, and further pages will be available be access the link in the <link> node w/ the relative attribute 'next'. For example:


<link href="/ws/customers/{user-name}/lists/{list-id}/members?next=gilznato-ftfj0w" rel="next"></link>

I hope this help, please let us know if you have any other questions or concerns regarding this.

David J

Highlighted
New Member

Re: Output Subscriber list to a private website

Thanks for your quick respone! I will give this a try.


 


 

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured