MDL-71329 tool_moodlenet: Check to see if we get errors before curl

This commit is contained in:
Mathew May 2021-04-20 15:47:41 +08:00
parent 9600becce3
commit 37a80759ea

View file

@ -310,11 +310,10 @@ class profile_manager {
'CURLOPT_HEADER' => 0, 'CURLOPT_HEADER' => 0,
]; ];
$content = $curl->get($url, null, $options); $content = $curl->get($url, null, $options);
$errno = $curl->get_errno();
$info = $curl->get_info(); $info = $curl->get_info();
// The base cURL seems fine, let's press on. // The base cURL seems fine, let's press on.
if (!$errno) { if (!$curl->get_errno() && !$curl->error) {
// WebFinger gave us a 404 back so the user has no droids here. // WebFinger gave us a 404 back so the user has no droids here.
if ($info['http_code'] >= 400) { if ($info['http_code'] >= 400) {
if ($info['http_code'] === 404) { if ($info['http_code'] === 404) {