[英]cURL error 28: Operation timed out after 2000 milliseconds with 7276200 out of 23000995 bytes received
[英]LaravelFacebookSDK Operation timed out after 0 milliseconds with 0 out of 0 bytes received
我如何增加laravelfacebooksdk的超時時間,卻收到錯誤消息:
[Facebook \\ Exceptions \\ FacebookSDKException]操作在0毫秒后超時,收到0字節中的0字節
請注意,我使用包裝容器Laravel Facebook SDK
我修改了此文件,以允許新的http_client_handler創建新實例,並在此更新了htt_client_handler,更新了composer.json以讀取Facebooksdk類。
composer.json
"autoload": {"classmap":
["database","/var/www/laravel/vendor/facebook/graph-sdk/src/Facebook"]
類xxx.php
class LongerTimeoutHttpClient extends
Facebook\HttpClients\FacebookStreamHttpClient
{public function send($url, $method, $body, array $headers, $timeOut){
$timeOut *= 4;
return parent::send($url, $method, $body, $headers, $timeOut);}}
public function handle(SammyK\LaravelFacebookSdk\LaravelFacebookSdk $fb)
{
$fbStream = new Facebook\HttpClients\FacebookStream;
$fb2 = $fb->newInstance([
'app_id' => env('FACEBOOK_APP_ID'),
'app_secret' => env('FACEBOOK_APP_SECRET'),
'default_graph_version' => 'v2.9',
'http_client_handler' => new LongerTimeoutHttpClient($fbStream),]);
}
這樣,我允許實例$ fb中的值超時。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.