'573168950803', 'media_url' => 'http://localhost/uploads/test.jpg', 'media_type' => 'image', 'caption' => 'Test de imagen', 'filename' => 'test.jpg' ]; echo "=== TEST API MULTIMEDIA ===\n\n"; echo "URL: $apiUrl\n"; echo "Datos enviados:\n"; print_r($data); echo "\n"; // Hacer petición $ch = curl_init($apiUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json' ]); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); curl_close($ch); echo "=== RESPUESTA ===\n"; echo "HTTP Code: $httpCode\n"; echo "Content-Type: $contentType\n"; echo "\nRespuesta RAW:\n"; echo $response; echo "\n\n"; // Intentar decodificar JSON echo "=== DECODIFICACIÓN JSON ===\n"; $decoded = json_decode($response, true); if ($decoded === null) { echo "ERROR: No se pudo decodificar JSON\n"; echo "JSON Error: " . json_last_error_msg() . "\n"; echo "\nPrimeros 500 caracteres de la respuesta:\n"; echo substr($response, 0, 500) . "\n"; } else { echo "JSON decodificado correctamente:\n"; print_r($decoded); } ?>