public function login($username, $password, $api_key = '') { $args = array('user' => $username, 'password' => $password); if ($api_key) { //The api_key variable is only required for production accounts //For the sandbox this is not necessary. $args['api_key'] = $api_key; } $response = array(); $response = $this->call('login', $args); if ($response['status_attr']['code'] != 'ok') { if (self::$_debug_level >= 1) { print "API->login = FALSE\n"; } die("ERROR: Login FAILED!\n"); } else { if (self::$_debug_level >= 1) { print "API->login = TRUE\n"; } self::$_auth = array('name' => $username, 'password' => $password); return true; } }