2
https://github.com/thujohn/twitter에 thujohn/twitter 패키지를 사용하여 내 사이트의 사용자 상태 게시물을 twitter로 업데이트합니다.Twitter API가있는 Laravel 대기열
애벌레의 대기열을 사용하여 백그라운드에서이 기능을 게시하고 싶습니다. 그러나 나는 실패한 일을 계속하고있다.
exception 'Exception' with message '[220] Your credentials do not allow access to this resource.' in /home/vagrant/sites/pms/vendor/thujohn/twitter/src/Thujohn/Twitter/Twitter.php:297
스택 추적 : 오류와
내 직업은 다음과 같습니다:
namespace PMS\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Twitter;
use Session;
use Illuminate\Http\Request;
class PostToTwitter implements ShouldQueue
{
use InteractsWithQueue, Queueable, SerializesModels;
public $tweetLength;
public $userPage;
public $body;
//public $twitterToken;
//public $secret;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($tweetLength, $userPage, $body)
{
$this->tweetLength = $tweetLength;
$this->userpage = $userPage;
$this->body = $body;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
Twitter::postTweet(['status' => str_limit($this->body . $this->userpage,$this->tweetLength), 'format' => 'json']);
}
}
및
내 컨트롤러에서 나는 다음과 같이 파견하고 있습니다 :$this->dispatch(new PostToTwitter($tweetLength, $userPage, $body));
내 함수는 컨트롤러에서 실행하면 제대로 작동하지만 작업에 디스패치하려고하면 작업이 실패합니다