Updated send check

This commit is contained in:
Tim Zandbergen 2021-12-11 01:35:48 +01:00 committed by GitHub
parent d7b505683e
commit 0ba1a765a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -85,12 +85,15 @@ class Octopush extends Core
$headers[] = 'Cache-Control: no-cache';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
$result = json_decode(curl_exec($ch), true);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (!in_array($httpcode, [200, 201]) || curl_errno($ch)) {
return "HTTP code: " . $httpcode . ".\ncURL error (" . curl_error($ch) . "): " . curl_errno($ch) . ". Look at http://www.octopush-dm.com/en/errors for the error description.";
}
$err = curl_errno($ch);
curl_close($ch);
if ($err != 0 || $httpcode != 201) {
return $result['code'] . " - " . $result['message'];
}
return 1;
}
}