up
This commit is contained in:
@@ -30,7 +30,9 @@ class MediaService {
|
||||
CURLOPT_URL => $endpoint,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $this->token],
|
||||
CURLOPT_TIMEOUT => 15
|
||||
CURLOPT_TIMEOUT => 15,
|
||||
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
]);
|
||||
$resp = curl_exec($ch);
|
||||
$http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
@@ -125,12 +127,19 @@ class MediaService {
|
||||
CURLOPT_TIMEOUT => 180,
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
CURLOPT_BUFFERSIZE => 65536,
|
||||
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4, // Forzar IPv4 (IPv6 no funciona en este host)
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, // Forzar HTTP/1.1 (HTTP/2 causa reset en lookaside.fbsbx.com)
|
||||
]);
|
||||
$content = curl_exec($ch);
|
||||
$err = curl_error($ch);
|
||||
$http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
if ($err || $http >= 400) return false;
|
||||
|
||||
// Log para diagnóstico
|
||||
if ($err || $http >= 400) {
|
||||
error_log("[MediaService::downloadUrl] FAIL url=" . substr($url, 0, 120) . " http={$http} err={$err}");
|
||||
return false;
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
@@ -447,7 +447,9 @@ class WhatsAppService
|
||||
'Authorization: Bearer ' . $this->token
|
||||
],
|
||||
CURLOPT_TIMEOUT => 300,
|
||||
CURLOPT_CONNECTTIMEOUT => 30
|
||||
CURLOPT_CONNECTTIMEOUT => 30,
|
||||
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
]);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
@@ -593,6 +595,8 @@ class WhatsAppService
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_MAXREDIRS => 3,
|
||||
CURLOPT_HEADER => true, // Capturar headers de respuesta
|
||||
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
]);
|
||||
|
||||
if ($method === 'POST' && $data) {
|
||||
@@ -899,7 +903,9 @@ class WhatsAppService
|
||||
'Authorization: Bearer ' . $this->token
|
||||
],
|
||||
CURLOPT_TIMEOUT => 60,
|
||||
CURLOPT_FOLLOWLOCATION => true
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
]);
|
||||
|
||||
$fileContent = curl_exec($ch);
|
||||
|
||||
Reference in New Issue
Block a user