TijsVerkoyen\Twitter\Twitter::statusesUpdate PHP Method

statusesUpdate() public method

Updates the authenticating user's status. A status update with text identical to the authenticating user's text identical to the authenticating user's current status will be ignored to prevent duplicates.
public statusesUpdate ( string $status, string[optional] $inReplyToStatusId = null, float[optional] $lat = null, float[optional] $long = null, string[optional] $placeId = null, bool[optional] $displayCoordinates = null, bool[optional] $trimUser = null ) : array
$status string The text of your status update, typically up to 140 characters. URL encode as necessary. t.co link wrapping may effect character counts. There are some special commands in this field to be aware of. For instance, preceding a message with "D " or "M " and following it with a screen name can create a direct message to that user if the relationship allows for it.
$inReplyToStatusId string[optional]
$lat float[optional]
$long float[optional]
$placeId string[optional]
$displayCoordinates bool[optional]
$trimUser bool[optional]
return array
    public function statusesUpdate($status, $inReplyToStatusId = null, $lat = null, $long = null, $placeId = null, $displayCoordinates = null, $trimUser = null)
    {
        // build parameters
        $parameters['status'] = (string) $status;
        $parameters['status'] = utf8_encode($parameters['status']);
        if ($inReplyToStatusId != null) {
            $parameters['in_reply_to_status_id'] = (string) $inReplyToStatusId;
        }
        if ($lat != null) {
            $parameters['lat'] = (double) $lat;
        }
        if ($long != null) {
            $parameters['long'] = (double) $long;
        }
        if ($placeId != null) {
            $parameters['place_id'] = (string) $placeId;
        }
        if ($displayCoordinates !== null) {
            $parameters['display_coordinates'] = $displayCoordinates ? 'true' : 'false';
        }
        if ($trimUser) {
            $parameters['trim_user'] = $trimUser ? 'true' : 'false';
        }
        // make the call
        return $this->doCall('statuses/update.json', $parameters, true, 'POST');
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Tests Twitter->statusesUpdate()
  */
 public function testStatusesUpdate()
 {
     $response = $this->twitter->statusesUpdate('Running the tests.. 私のさえずりを設定する ' . time());
     $this->isTweet($response);
     $this->twitter->statusesDestroy($response['id']);
 }
Twitter