laravel - cURL 错误 28:连接在 1001 毫秒后超时(参见 http://curl.haxx.se/libcurl/c/libcurl-errors.html)
问题描述
我正在使用 laravel 框架。AWS SNS 服务借助附加的链接在我的项目中使用并安装了所有 requiremnet。
https://www.kerneldev.com/2018/01/03/send-sms-in-laravel-using-aws-sns/
但出现 cURL 错误 28:连接在 1001 毫秒后超时(请参阅http://curl.haxx.se/libcurl/c/libcurl-errors.html)
删除了旧的访问密钥和秘密密钥,并在 aws 控制台中添加了新的,并在 config/aws.php 中更改了密钥
在 DNS 设置中添加了所有 TXT 和 DKIM 记录
创建的网络路由
Route::get('/sendSMS/{phone_number}', 'SMSController@sendSMS');
创建控制器
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use AWS;
class SMSController extends Controller
{
protected function sendSMS($phone_number){
$sms = AWS::createClient('sns');
$sms->publish([
'Message' => 'Hello, This is just a test Message',
'PhoneNumber' => $phone_number,
'MessageAttributes' => [
'AWS.SNS.SMS.SMSType' => [
'DataType' => 'String',
'StringValue' => 'Transactional',
]
],
]);
}
}
解决方案
替换CURLOPT_TIMEOUT_MS
为CURLOPT_CONNECTTIMEOUT
_CurlFactory.php.
$conf[CURLOPT_CONNECTTIMEOUT] = $options['timeout'] * 10000;
这对我有用,试试吧。
推荐阅读
- javascript - 如何在 React 中创建使用状态和道具的可重用函数
- amazon-web-services - 如何离线使用 AWS SAM CLI 本地 HttpAPI 和 JWT Bearer 令牌认证?
- pine-script - Pine Editor:如何将非标准指标中的值调用到脚本中
- python - 使用行参考验证 Python Pandas 数据框列
- binary-tree - 在无组织的二叉树中搜索节点?
- javascript - 未捕获的 TypeError 无法读取 null 的“已检查”属性
- python - 使用基本映像和使用 apt 有什么区别?
- python - 如何根据另一列的值检查一列是否为空?
- python - Python SendInput() 按键无法识别
- qt - 在 Qt 上启动后台进程并加载响应式 shell 环境