Vision Payroll


include(“class.ConstantContact.php”);

$loginName = ‘visionpayroll’;
$loginPassword = ‘len9712’;

$tmpConstCont = new ConstantContact($loginName,$loginPassword);

$tmpConstCont->setCategory(‘General Interest’);
$tmpConstCont->setEmail(‘info@visionpayroll.com’);

//FirstName and LastName are optional settings
//if they are not needed then just comment the
//next two lines out.
//$tmpConstCont->setFirstName(‘Joe’);
//$tmpConstCont->setLastName(‘Smith’);

$response = $tmpConstCont->registerEmail();
if ($response == 0) {
echo “Added”;
} else {
echo “Not Added.”;
}

NO EDITING IN THE CLASS IS NEEDED

*/

class ConstantContact {

function ConstantContact($tmpName, $tmpPassword) {
$this->loginName = urlencode(strip_tags($tmpName));
$this->loginPassword = urlencode(strip_tags($tmpPassword));
$this->curlvar = “http://ccprod.roving.com/roving/wdk/API_AddSiteVisitor.jsp?loginName=”. $this->loginName
.”&loginPassword=” . $this->loginPassword . “&”;
$this->email = ”;
$this->category = ”;
$this->fName = ”;
$this->lName = ”;
}
function setEmail($tmpEmail) {
$this->email = urlencode(strip_tags($tmpEmail));
}
function setCategory($tmpCat) {
$this->category = urlencode(strip_tags($tmpCat));
}

function setFirstName($fname) {
$this->fName = $fname;
}

function setLastName($lname) {
$this->lName = $lname;
}

function registerEmail() {
$tmpUrl = $this->curlvar . “ea=” . $this->email . “&ic=” . $this->category . ( $this->fName != ” ? ‘&First_Name=’ . $this->fName : ” ) . ( $this->lName != ” ? ‘&Last_Name=’ . $this->lName : ” );
if ( isset($this->email) && $this->email != ” && isset($this->category) && $this->category != ” ) {
$this->category = ”;
$this->email = ”;
$this->fName = ”;
$this->lName = ”;
$ch = curl_init($tmpUrl);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
$end = strtok($response, ” “);
return $end; //returns 0 if submitted and 500 if not submitted
}
$this->category = ”;
$this->email = ”;
$this->fName = ”;
$this->lName = ”;
return false;
}
}

// —————————————–
$loginName = ‘visionpayroll’;
$loginPassword = ‘len9712’;
$category = ‘General Interest’;

$tmpConstCont = new ConstantContact($loginName,$loginPassword);

$tmpConstCont->setCategory($category);
$tmpConstCont->setEmail(strip_tags($_POST[‘newsletterEmail’]) );

$response = $tmpConstCont->registerEmail();

if ($response == 0) {
echo “You have been added to our newsletter. Thank you for your interest.”;
} else {
echo “There was a problem adding you to our newsletter, please try again.”;
}
?>

Contact Us Vision Payroll
Client Remote Access