php - curl_multi_exec - 部分请求返回 CURLE_COULDNT_RESOLVE_HOST
问题描述
全部!A有问题。我的主机是godaddy
php -v
ea-php-cli Copyright 2017 cPanel, Inc.
PHP 5.6.36 (cli) (built: May 29 2018 01:55:39)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
卷曲-V
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
php -i | grep 卷曲
cURL support => enabled
cURL Information => 7.60.0
在我的脚本中,我使用Zebra_cURL库
在我的脚本中:
for ($i=0;$i<50;$i++)
{
$query = "https://mylink";
$positions[$query] = $myData
}
require 'Zebra_cURL.php';
$curl = new Zebra_cURL();
$curl->cache(false);
$curl->get(array_keys($positions), 'workWithPositions', $positions);
我的回调:
function workWithPositions($result, $positions) {
if ($result->response[1] == CURLE_OK) {
if ($result->info['http_code'] == 200) {
// mycode
} else {
die('Server responded with code ' . $result->info['http_code']);
}
} else {
echo('cURL responded with: ' . $result->response[0]. ' - '.$result->info['original_url']."\n<br/>");
}
}
问题是通过 CLI 运行 10 次或更多脚本时,某些 URL 会产生错误
“cURL 回应:CURLE_COULDNT_RESOLVE_HOST - https://mylink ”
错误的数量总是不同的。URL 总是正确的(它们在浏览器中打开)。如果您通过命令行通过 curl 请求相同的 URL,则始终可以正确处理所有内容。
也许有人会告诉我到底是什么问题?
解决方案
推荐阅读
- python - 熊猫:JSONDecodeError:预期值:第 1 行第 1 列(字符 0)
- node.js - 如何从 Electron 内部访问 NSApplication
- reactjs - React:如何在 VerticalTimelineElement 中插入我自己的图标?
- c# - 如何根据输入文件过时执行 msbuild (csproj) 目标
- python - asyncpg/fastapi 创建的连接多于池限制
- android - Mediapipe 跟踪 AAR 构建失败:按架构过滤 AAR 本机库失败
- excel - 如何在 Excel 中用逗号分隔值的列中搜索数字
- apache - 我用 Apache2.0 和谷歌云建立了一个媒体维基,但 DNS 似乎很奇怪
- matlab - Matlab中的向量化循环
- r - 在 R 中移动一列