$userinfo = array();
     $userinfo['emailAddress'] = $_POST["searchEmailAddress"];
     $userinfo['firstName'] = $_POST["firstName"];
     $userinfo['lastName'] = $_POST["lastName"];
     $userinfo['lists'] = array('http://api.constantcontact.com/ws/customers/armiaconstantcontact/lists/1');
     $objUserinfo = new Contact($userinfo);
     //  print_r($objUserinfo);exit;
     $addEmial = $ConstantContact->addContact($objUserinfo);
     print_r($addEmial);
 } else {
     if ($_POST['GetList'] == 'Get List') {
         $Lists = $ConstantContact->getLists();
         print_r($Lists);
     } else {
         if ($_POST['GetEmailList'] == 'Get Email List') {
             $VerifiedEmailAddresses = $ConstantContact->getVerifiedAddresses();
             print_r($VerifiedEmailAddresses);
         } else {
             if ($_POST['SetCampaign'] == 'Set Campaign') {
                 $myCampaign = new Campaign();
                 $temp = '<html>
                                 <body>
                                 Hi test mail
                                 </body>
                                 </html>';
                 // Decode the email content and store it back into emailContent
                 $myCampaign->name = 'Test Campaign1';
                 $myCampaign->subject = 'Test subject Campaign';
                 $myCampaign->fromName = 'Test Akhil';
                 $VerifiedEmailAddresses = $ConstantContact->getVerifiedAddresses();
                 $fromAddress1 = '*****@*****.**';
# The code below checks to see if the wrapper library has a user in the datastore that has been authorized during the current session.
# If so, a form is loaded, and a request to create an email campaign is executed when the form is submitted.
# An object created from the XML in the API response is then echoed below the form, or an HTTP status code/error will be displayed.
# If the authorization is not current for the current session, an OAuth exception is throw, and a link to begin the OAuth 2.0 flow is provided.
# As authorization/authentication credentials are stored in the session by default, navigating away from your server, of failing to include session_start(); at the top of any intermediary scripts executed after authorization will cause credentials to be lost, so we recommend altering the functions in the CTCTDataStore() class or otherwise adding code of your own to save the OAuth access token securely on your server by whatever means is best suited to your needs.
?>

<h2>Simple Add/Create Campaign Example</h2>

<?php 
if ($username) {
    $ConstantContact = new ConstantContact('oauth2', $apiKey, $username, $accessToken);
    //gets first 50 contact lists, if more exist, a nextlink is returned in the $ContactLists object
    $ContactLists = $ConstantContact->getLists();
    //gets verified account email addresses which can be used as from and rely-to addresses
    $VerifiedAddresses = $ConstantContact->getVerifiedAddresses();
    $testCampaign = new Campaign();
    ?>

<form name="addCampaign" action="" method="post">
    Campaign Name: <input type="text" size="50" name="campaign_name" /><br />
    Subject Line: <input type="text" size="50" name="subject_line" /><br />
	From Name: <input type="text" size="50" name="from_name" /><br />
	<h4>From Email Address</h4>
    <div style="overflow: auto; width: 400px;">
    <?php 
    foreach ($VerifiedAddresses['addresses'] as $key => $addr) {
        echo '<input type="radio" name="from" value="' . $key . '"> ' . $addr->email . '<br />';
    }
    ?>
    </div>
             $addEmailReturn = $ConstantContact->addContact($objUserinfo);
             if ($addEmailReturn) {
                 $_SESSION['constantresult'] = "Email subscribed sucessfully!";
             }
         } else {
             $_SESSION['constantresult'] = "Email subscribed failed!";
         }
     } else {
         $_SESSION['constantresult'] = "Email subscribed failed!";
     }
 } else {
     if ($_SESSION['constantaction'] == 'Get List') {
         $_SESSION['constantresult'] = $ConstantContact->getLists();
     } else {
         if ($_SESSION['constantaction'] == 'Get Email List') {
             $_SESSION['constantresult'] = $ConstantContact->getVerifiedAddresses();
         } else {
             if ($_SESSION['constantaction'] == 'Set Campaign') {
                 $myCampaign = new Campaign();
                 $VerifiedEmailAddresses = $ConstantContact->getVerifiedAddresses();
                 /*  $temp = '<html>
                     <body>
                     Hi test mail
                     </body>
                     </html>';*/
                 // Decode the email content and store it back into emailContent
                 $myCampaign->name = 'Test Campaign1';
                 $myCampaign->subject = 'Test subject Campaign';
                 $myCampaign->fromName = 'Test Akhil';
                 $fromAddress1 = '*****@*****.**';
                 do {