laravel - 执行 HTTP 请求我想将延迟时间从 Laravel 添加到外部 API
问题描述
我想在从 laravel 延迟时间大约 10,20 秒调用我的 api 之前添加一个延迟时间,然后它应该被执行。
我的代码是:
$base_url = 'https://pk.qareeb.com/';
$api_path = 'rest/all/V1/orders/';
$arr['searchCriteria']['filterGroups'][0]['filters'][0]['field'] = 'increment_id';
$arr['searchCriteria']['filterGroups'][0]['filters'][0]['value'] = $payload;
$arr['searchCriteria']['filterGroups'][0]['filters'][0]['conditionType'] = '=';
$url = $base_url . $api_path .'?'. http_build_query($arr);
$client = new Client();
$headers = [
'Authorization' => 'Bearer ' . $token,
'Accept' => 'application/json',
];
$response = $client->request('GET', $url
, [
'headers' => $headers
]);
$statusCode = $response->getStatusCode();
$body = json_decode($response->getBody()->getContents());
我想在客户端调用 api 时添加延迟时间?
解决方案
推荐阅读
- node.js - Mongoose 不同的 Model.Discriminator() 模式创建重复键错误
- .htaccess - apache 2上的图像缓存问题
- c# - 解码十六进制 PDF 并作为电子邮件附件发送
- python - 无法在 python 中使用 Google Calendar API 找到 client_secret.json
- python - 嵌套列表项未从 Flask 会话中删除
- cisco - OPEN VPN 与 CISCO ASA 5580 的兼容性
- javascript - 客户端脚本 javascript -language 或多种语言
- python - 使用 Python 2 的全屏幻灯片
- jasmine - protractor getCssValue('background') 返回几个信息
- r - 如何将公共行添加在一起?