You are here

public function Twitter::friendships_create in Twitter 7.5

Same name and namespace in other branches
  1. 6.5 twitter.lib.php \Twitter::friendships_create()
  2. 7.6 twitter.lib.php \Twitter::friendships_create()

Allows the authenticating users to follow the user specified in the ID parameter.

Parameters

mixed $id: The user ID or the screen name.

bool $follow: Wether to enable notifications for the target user.

Return value

The befriended user in the requested format when successful, or a string describing the failure condition when unsuccessful.

See also

https://dev.twitter.com/docs/api/1.1/post/friendships/create

File

./twitter.lib.php, line 796
Integration layer to communicate with the Twitter REST API 1.1. https://dev.twitter.com/docs/api/1.1

Class

Twitter
Primary Twitter API implementation class

Code

public function friendships_create($id, $follow = NULL) {
  if (is_numeric($id)) {
    $params['user_id'] = $id;
  }
  else {
    $params['screen_name'] = $id;
  }
  if ($follow !== NULL) {
    $params['follow'] = $id;
  }
  return $this
    ->call('friendships/create', $params, 'POST');
}