You are here

function constant_contact_auth in Constant Contact 6.3

Same name and namespace in other branches
  1. 6.2 constant_contact.ajax.php \constant_contact_auth()

Authenticates with the API This is used for the admin settins page to check the details they entered

1 call to constant_contact_auth()
constant_contact.ajax.php in ./constant_contact.ajax.php

File

./constant_contact.ajax.php, line 12

Code

function constant_contact_auth($username, $password) {
  require_once dirname(__FILE__) . '/class.cc.php';
  $cc = new cc($username, $password);
  if (is_object($cc) && $cc
    ->get_service_description()) {

    // we have successfully connected
    return $cc;
  }
  elseif ($cc->http_response_code) {

    // oops, problem occured and we have an error code
    return $cc
      ->http_get_response_code_error($cc->http_response_code);
  }
  else {
    return "Please enter your username and password";
  }
}