2016-10-05 6 views
2

私はlarvalのキューをFacebookに投稿しようとしていますが、運がないです!私のコードは、キューを使用せずに正常に動作しますが、私はキューと同じコードを使用できるようにする必要があります。LaravelキューとFacebookへの投稿

私は失敗したジョブの表に、この例外を取得しています:Facebookのに画像を投稿する

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 

私の最初のコードは次のようになります。私と一緒に今

try { 
    $fb->setDefaultAccessToken($token); 
    $fb->post('/me/photos', [ 
     'url' => cloudinary_url("$photorequest"), 
     'caption' => $body . $userPage 
    ]); 
} catch (Facebook\Exceptions\FacebookResponseException $e) { 
    // continue to next request; 
} 

使用しようとし私の仕事のフォルダでこれをやった:

これを私のコントローラで呼び出す:

$this->dispatch(new PostToFBwithImage($token, $photorequest, $userPage, $body)); 

私のPostToFBwithImageクラスで何か問題が起きていることは知っていますが、わかりません。

+0

どのキュードライバを使用していますか?そして、どのようにこのコードは動作していませんか?何かエラーがありますか? – Aron

答えて

0

この

$fb->setDefaultAccessToken($token); 
$fb->post('/me/photos', ['url' => cloudinary_url("$photorequest"),'caption' => $body . $userPage]); 

この

$fb->setDefaultAccessToken($this->token); 
$fb->post('/me/photos', ['url' => cloudinary_url($this->photorequest), 'caption' => $this->body . $this->userPage]); 

ではないでしょうか?

また、ジョブの作成時に正しい値をコンストラクタに渡していますか?