all! A have a problem. My hosting is 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
curl -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
cURL support => enabled
cURL Information => 7.60.0
In my script I use Zebra_cURL library
In my script:
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);
My callback:
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/>");
}
}
The problem is that with 10 and more runs of the script through the CLI, some of the URLs produce an error
"cURL responded with: CURLE_COULDNT_RESOLVE_HOST - https://mylink"
The number of errors is always different. URLs are always correct (they open in the browser). If you request the same URL through curl via the command line, everything is always handled correctly.
Maybe someone will tell me what exactly the problem may be?