OAuth 1.0 Request on user behalf help


#1

I have the user access token and secret and I am trying to make a php request on there behalf
I am using the pecl library of OAuth and here is what I have

public function postMessageForUser($user,$message)
{
try
{
$result = $this->twitterDBAccess->getUserTokens($user);
$this->twitterOAuth->setToken($result[“access_token”],$result[“access_token_secret”]);
//echo urlencode(utf8_encode($message));

	$data = array();
	$data['post']['status'] = "Hello%20Ladies%20%2b%20Gentlemen%2c%20a%20signed%20OAuth%20request%21";
	
	$responce = $this->twitterOAuth->fetch("http://api.twitter.com/1/statuses/update.json",$data);
		
	echo $responce;
}
catch(OAuthException $E)
   {
        echo 'Exception: ' . $E . '\n';
    }

}


#2

What’s the error you get?

I don’t really know much about the OAuth PECL library, but I really suggest using the tmhOAuth library if you’re new to OAuth and the Twitter API. It has a lot of good examples which are easy to follow: https://github.com/themattharris/tmhOAuth