Thanks for the explanation Taylor.
I shall see what I can get from the users/show url.
Iâm now trying to post a tweet but I get a
<?xml version="1.0" encoding="UTF-8"?>
Could not authenticate you.
/1/statuses/update.xml
response.
I wonder why since Iâm currently logged in twitter.com and using the same opened browser instance of Firefox from which my website posts the tweet.
Do I need to have more parameters than these ?
function postNotification($message) {
$this->loadProperties();
$consumerSecret = $this->consumerSecret;
$url = 'http://api.twitter.com/1/statuses/update.format';
$params = array();
$params['oauth_version'] = '1.0';
$params['oauth_nonce'] = mt_rand();
$params['oauth_timestamp'] = time();
$params['oauth_signature_method'] = 'HMAC-SHA1';
$params['oauth_signature'] = LibUtils::computeHmacSha1Signature('POST', $url, $params, $consumerSecret, null);
$params['status'] = $message;
$queryParameterString = LibUtils::oauthHttpBuildQuery($params);
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$response = LibUtils::sendPostCurlRequest($url, $queryParameterString, 80, $headers);
if (!empty($response)) {
list($info, $header, $body) = $response;
if ($info['http_code'] == 200 && !empty($body)) {
$parsedBody = LibUtils::queryStringToArray($body);
}
}
}