private function sendWappiMessage($phone, $message, $profile_id, $api_key) {
$url = "https://wappi.pro/api/sync/message/send?profile_id=" . urlencode($profile_id);
$data = [
'recipient' => $phone,
'body' => $message
];
$headers = [
'Authorization: ' . $api_key,
'Content-Type: application/json'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data, JSON_UNESCAPED_UNICODE));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curl_error = curl_error($ch);
curl_close($ch);
// Логируем ответ для отладки
$this->log->write("Wappi API URL: " . $url);
$this->log->write("Wappi API Response: " . $response);
$this->log->write("Wappi HTTP Code: " . $http_code);
if ($curl_error) {
$this->log->write("Wappi CURL Error: " . $curl_error);
return [
'success' => false,
'message' => 'CURL Error: ' . $curl_error
];
}
$response_data = json_decode($response, true);
if ($http_code == 200) {
if (isset($response_data['success']) && $response_data['success']) {
return [
'success' => true,
'data' => $response_data
];
} else {
$error_msg = isset($response_data['message']) ? $response_data['message'] : 'Unknown API error';
$this->log->write("Wappi API Error: " . $error_msg);
return [
'success' => false,
'message' => $error_msg
];
}
} else {
$error_msg = 'HTTP Error: ' . $http_code;
if (isset($response_data['message'])) {
$error_msg = $response_data['message'];
} elseif (isset($response_data['error'])) {
$error_msg = $response_data['error'];
}
$this->log->write("Wappi HTTP Error: " . $error_msg);
return [
'success' => false,
'message' => $error_msg,
'http_code' => $http_code
];
}
}
Fatal error: Uncaught Error: Class 'Controllerextensionmodulesmsreg' not found in /var/www/vhosts/butuz.kz/httpdocs/system/storage/modification/system/engine/action.php:48
Stack trace:
#0 /var/www/vhosts/butuz.kz/httpdocs/system/storage/modification/system/engine/loader.php(29): Action->execute(Object(Registry), Array)
#1 /var/www/vhosts/butuz.kz/httpdocs/system/storage/modification/catalog/controller/common/header.php(52): Loader->controller('extension/modul...')
#2 /var/www/vhosts/butuz.kz/httpdocs/system/storage/modification/system/engine/action.php(56): ControllerCommonHeader->index(Array)
#3 /var/www/vhosts/butuz.kz/httpdocs/system/storage/modification/system/engine/loader.php(29): Action->execute(Object(Registry), Array)
#4 /var/www/vhosts/butuz.kz/httpdocs/system/storage/modification/catalog/controller/product/category.php(740): Loader->controller('common/header')
#5 /var/www/vhosts/butuz.kz/httpdocs/system/storage/modification/system/engine/action.php(56): ControllerProductCategory->index()
#6 /var/www/vhosts/butu in /var/www/vhosts/butuz.kz/httpdocs/system/storage/modification/system/engine/action.php on line 48