src/snapchat.php
public function addFriends($usernames) {
		// Make sure we're logged in and have a valid access token.
		if (!$this->auth_token || !$this->username) {
			return FALSE;
		}

		$friends = array();
		foreach ($usernames as $username) {
			$friends[] = (object) array(
				'display' => '',
				'name' => $username,
				'type' => self::FRIEND_UNCONFIRMED,
			);
		}

		$timestamp = parent::timestamp();
		$result = parent::post(
			'/friend',
			array(
				'action' => 'multiadddelete',
				'friend' => json_encode(array(
					'friendsToAdd' => $friends,
					'friendsToDelete' => array(),
				)),
				'timestamp' => $timestamp,
				'username' => $this->username,
			),
			array(
				$this->auth_token,
				$timestamp,
			)
		);

		return !empty($result->message);
	}
public function addFriends($usernames) {
		// Make sure we're logged in and have a valid access token.
		if (!$this->auth_token || !$this->username) {
			return FALSE;
		}

		$friends = array();
		foreach ($usernames as $username) {
			$friends[] = (object) array(
				'display' => '',
				'name' => $username,
				'type' => self::FRIEND_UNCONFIRMED,
			);
		}

		$timestamp = parent::timestamp();
		$result = parent::post(
			'/friend',
			array(
				'action' => 'multiadddelete',
				'friend' => json_encode(array(
					'friendsToAdd' => $friends,
					'friendsToDelete' => array(),
				)),
				'timestamp' => $timestamp,
				'username' => $this->username,
			),
			array(
				$this->auth_token,
				$timestamp,
			)
		);

		return !empty($result->message);
	}
public function addFriends ( $ usernames ) { // Make sure we're logged in and have a valid access token. if ( ! $ this -> auth_token || ! $ this -> username ) { return FALSE ; } $ friends = array ( ) ; foreach ( $ usernames as $ username ) { $ friends [ ] = ( object ) array ( 'display' => '' , 'name' => $ username , 'type' => self :: FRIEND_UNCONFIRMED , ) ; } $ timestamp = parent :: timestamp ( ) ; $ result = parent :: post ( '/friend' , array ( 'action' => 'multiadddelete' , 'friend' => json_encode ( array ( 'friendsToAdd' => $ friends , 'friendsToDelete' => array ( ) , ) ) , 'timestamp' => $ timestamp , 'username' => $ this -> username , ) , array ( $ this -> auth_token , $ timestamp , ) ) ; return ! empty ( $ result -> message ) ; }
Adds multiple friends.

@param array $usernames
Usernames of friends to add.

@return bool
TRUE if successful, FALSE otherwise.
Adds multiple friends .