I get a strange error and couldn’t find the answer..
This code works well:
$receiverScrName='name';
$method = 'direct_messages/new';
$parameters = array('screen_name' => $receiverScrName, 'text' => 'how are you');
$dm = $oauth->post($method, $parameters);
This code below doesn’t work. Only change is “$message” parameter.
$receiverScrName='name';
$message='Hello man';
$method = 'direct_messages/new';
$parameters = array('screen_name' => $receiverScrName, 'text' => $message);
$dm = $oauth->post($method, $parameters);
It gives error:
stdClass Object ( [error] => Could not authenticate with OAuth.
[request] => /1/direct_messages/new.json )
I tried to encode “message” :
$message='Hello man';
$message=urlencode($message);
$method = 'direct_messages/new';
$parameters = array('screen_name' => $receiverScrName, 'text' => $message );
$dm = $oauth->post($method, $parameters);
The message is sent.
But the received message became “Hello+man”.
How can i remove “plus” or other escaped characters from the message that will be sended?
Thank you
I found out that this problem is related with non-ASCII characters in message text.
When i transliterate them it is worked.