I am creating my own function for authenticating/authorizing a user and then sending a Tweet.
The frustrating thing is, the Tweet will only be created if the status text is wrapped in DOUBLE rawurlencode:
$status = 'Hello World';
$options = array(
CURLOPT_HTTPHEADER => array($authHeader),
CURLOPT_HEADER => false,
CURLOPT_URL => $baseUri,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => 'status=' . rawurlencode(rawurlencode($status)),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_VERBOSE => true,
CURLOPT_SSL_VERIFYPEER => false
);
The above tweets: “Hello%20World”
If I change the POSTFIELDS to be rawurlencode($status) or simply $status, the tweet fails with the following response:
object(stdClass)#21 (1) {
[“errors”] => array(1) {
[0] => object(stdClass)#94 (2) {
[“message”] => string(26) “Could not authenticate you”
[“code”] => int(32)
}
}
}
I can post the rest of my code if you like, but hopefully you can assume it’s ok on the basis that tweets are generated in some circumstances…
I’ve even tried the default output the Twitter oAuth Tool generates: Also fails 
I think this is clearly something to do with the encoding of the $status string, but I can’t see what I’m doing wrong.