Closed gentjana closed 6 years ago
i'm using the below code for reply to a direct message, but i receive error: 400. What i'm doing wrong? Please help is important to do the changes in twitter api before 19 June. Thanks.
ini_set('display_errors', 1); require_once('TwitterAPIExchange.php');
$settings = array( 'oauth_access_token' => '', 'oauth_access_token_secret' => '', 'consumer_key' => '', 'consumer_secret' =>'', );
$twitter = new TwitterAPIExchange($settings);
$url = "https://api.twitter.com/1.1/direct_messages/events/new.json";
$method = 'POST'; $params = json_encode(array( 'event' => array( 'type' => 'message_create', 'message_create' => array( 'target' => array( "recipient_id" => '123'), 'message_data' => array( 'text' => 'Hello' ) ) ) ) ); $twitter->buildOauth($url, $method) ->performRequest(true, array(CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), CURLOPT_POSTFIELDS => $params));
i'm using the below code for reply to a direct message, but i receive error: 400. What i'm doing wrong? Please help is important to do the changes in twitter api before 19 June. Thanks.
ini_set('display_errors', 1); require_once('TwitterAPIExchange.php');
$settings = array( 'oauth_access_token' => '', 'oauth_access_token_secret' => '', 'consumer_key' => '', 'consumer_secret' =>'', );
$twitter = new TwitterAPIExchange($settings);
$url = "https://api.twitter.com/1.1/direct_messages/events/new.json";