Abraham\TwitterOAuth\TwitterOAuth::post PHP Method

post() public method

Make POST requests to the API.
public post ( string $path, array $parameters = [] ) : array | object
$path string
$parameters array
return array | object
    public function post($path, array $parameters = [])
    {
        return $this->http('POST', self::API_HOST, $path, $parameters);
    }

Usage Example

コード例 #1
2
 function PostImage()
 {
     if (!isset($_POST['source']) || $_POST['source'] == "") {
         return "Missing required params";
     }
     $config = (include "/config.php");
     $source = $_POST['source'];
     $final = "";
     if (isset($_POST['message'])) {
         $orig = $_POST['message'];
         $final = FilterText($orig);
     }
     $access_token = $_SESSION['access_token'];
     $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
     $check = new TB_Twitter_Check();
     if (!$check->VerifyTweet($source, $final)) {
         return "Tweet is not valid";
         exit;
     }
     $media1 = $connection->upload('media/upload', array('media' => $source));
     $parameters = array('status' => $final, 'media_ids' => implode(',', array($media1->media_id_string)));
     $result = $connection->post('statuses/update', $parameters);
     if ($connection->getLastHttpCode() == 200) {
         return "success";
     } else {
         return "An unnknown error occured";
     }
 }
All Usage Examples Of Abraham\TwitterOAuth\TwitterOAuth::post