-
Notifications
You must be signed in to change notification settings - Fork 231
Description
I've been using Codebird for php for Twitter since it came out and now have version 3-1-5.
With this I've been trying to develop a direct messaging app and seem to have a whole lot of problems I can not figure out how to fix, thus I need your input on how to solve these issues.
Here is my code:
public function __construct($CKey,$CPriv,$APIK, $APIP,$ForWho = null){
ob_start();
$this->twitter = new TwitterMessages($CKey,$CPriv,$APIK,$APIP,$ForWho);
$SleepTime = 4900;
if (ob_get_level() == 0) ob_start();
$this->ConsumerKey = $CKey;
$this->ConsumerSec = $CPriv;
$this->APIKey = $APIK;
$this->APISec = $APIP;
$this->ForWho = $ForWho;
date_default_timezone_set('America/New_York');
}
public function SendDM($Resip,$MText,$URL,$PhotoID,$Lable){
$Reply = $this->twitter->VerifyCredentials($Twitter->cb);
if( $Reply->httpstatus == 200 ){
$Param = [
'event' => [
'type' => 'message_create',
'message_create' => [
'target' => [
'recipient_id' => "$Resip"
],
'message_data' => [
'text' => "$AdText",
]
'attachment' => [
'type' => "media",
'media' => [
'id' => $PhotoID
]
]
]
]
]
];
$reply = $this->twitter->cb->directMessages_events_new($Param);
return $reply;
}
else{
return FALSE;
}
}
Within the code on the $reply I am always getting:
code = 32
message = "Could not authenticate you."
httpstatus = 401
From past experiences with this error I've realized that this means something is wrong with the way I am sending the request.
So can anyone help in this problem I am having?
Frank