本帖最后由 Front 于 2022-3-31 09:59 编辑
- <?php
- $curl = curl_init();
- curl_setopt_array($curl, array(
- CURLOPT_URL => 'http://www.baidu.com/',
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_ENCODING => '',
- CURLOPT_MAXREDIRS => 10,
- CURLOPT_TIMEOUT => 0,
- CURLOPT_FOLLOWLOCATION => true,
- CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
- CURLOPT_CUSTOMREQUEST => 'GET',
- CURLOPT_HTTPHEADER => array(
- 'Connection: <Connection>',
- 'Accept: <Accept>',
- 'User-Agent: <User-Agent>',
- 'Sec-Fetch-Site: <Sec-Fetch-Site>',
- 'Sec-Fetch-Mode: <Sec-Fetch-Mode>',
- 'Sec-Fetch-Dest: <Sec-Fetch-Dest>',
- 'Referer: <Referer>',
- 'Accept-Language: <Accept-Language>',
- 'Cookie: <Cookie>'
- ),
- ));
- $response = curl_exec($curl);
- curl_close($curl);
- echo $response;
复制代码
如题,因为我调用个api就必须要执行2次,但执行1次下一次要间隔3秒后才可以执行2,不然后会提示:操作失败,操作过于频繁,请过3秒后再试。
有什么方案吗? |