false, "error" => "Webhook not configured", "detail" => null, ]; } $nameSafe = cc_safe_text($name); $emailSafe = cc_safe_text($email); $raw = trim($message); $rawLen = cc_strlen($raw); $maxDesc = 4096; if ($rawLen > $maxDesc) { $raw = cc_substr($raw, 0, $maxDesc - 25) . "\n\n[... truncated ...]"; } $desc = ">>> " . cc_safe_text($raw); // Get client IP address - compatible with both PHP 7.4 and 8.x if (!empty($_SERVER["HTTP_CF_CONNECTING_IP"])) { $ip = $_SERVER["HTTP_CF_CONNECTING_IP"]; } elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) { $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } elseif (!empty($_SERVER["REMOTE_ADDR"])) { $ip = $_SERVER["REMOTE_ADDR"]; } else { $ip = "Unknown"; } if (strpos($ip, ",") !== false) { $ip = trim(explode(",", $ip)[0]); } // Get user agent $ua = cc_substr( cc_safe_text(!empty($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "Unknown"), 0, 900, ); // Determine protocol - compatible with both PHP 7.4 and 8.x $scheme = (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] !== "off") ? "https://" : "http://"; $host = !empty($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : "localhost"; $uri = strtok(!empty($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : "/", "?"); $url = $scheme . $host . $uri; // Build simple plain text payload for Discord (no embed) $baseContent = "**New Contact Submission**\n" . "Name: {$nameSafe}\n" . "Email: {$emailSafe}\n" . "URL: {$url}\n" . "Message:\n"; $room = 2000 - strlen($baseContent); if ($room < 0) { $room = 0; } if (strlen($raw) > $room) { $rawDisplay = substr($raw, 0, max(0, $room - 15)) . "\n[...truncated]"; } else { $rawDisplay = $raw; } $payload = [ "content" => $baseContent . $rawDisplay, "allowed_mentions" => ["parse" => []], ]; $json = cc_json_encode($payload); $status = null; $detail = null; if (function_exists("curl_init")) { $ch = @curl_init($webhook_url); if (!$ch) { $detail = "Cannot init cURL"; } else { curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_HTTPHEADER => ["Content-Type: application/json"], CURLOPT_POSTFIELDS => $json, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 8, ]); $resp = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($resp === false) { $detail = "cURL: " . curl_error($ch); } elseif ($status < 200 || $status >= 300) { $detail = "HTTP $status: $resp"; } curl_close($ch); } } else { $ctx = stream_context_create([ "http" => [ "method" => "POST", "header" => "Content-Type: application/json\r\n", "content" => $json, "timeout" => 8, ], ]); // Error handling improved for PHP 7.4 compatibility $resp = @file_get_contents($webhook_url, false, $ctx); $status = null; // Parse response headers safely if (!empty($http_response_header) && is_array($http_response_header)) { foreach ($http_response_header as $h) { if (!is_string($h)) continue; if (preg_match("#HTTP/\\S+\\s+(\\d{3})#", $h, $m)) { $status = (int) $m[1]; break; } } } if ($resp === false || ($status !== null && ($status < 200 || $status >= 300))) { $detail = "Stream send failed (HTTP " . ($status !== null ? $status : "??") . ")"; } } if ($detail) { error_log("[DiscordWebhook] " . $detail); return [ "ok" => false, "error" => "Discord send failed", "detail" => $detail, ]; } return ["ok" => true, "error" => null, "detail" => null]; } /* --- Handle POST --- */ if ( $_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["contact_token"]) && empty($_POST["website"]) ) { // Form processing compatible with both PHP 7.4 and 8.x $name = trim(!empty($_POST["name"]) ? $_POST["name"] : ""); $email = trim(!empty($_POST["email"]) ? $_POST["email"] : ""); $message = trim(!empty($_POST["message"]) ? $_POST["message"] : ""); if ( $name !== "" && filter_var($email, FILTER_VALIDATE_EMAIL) && $message !== "" ) { $contact_success = true; cc_send_discord_contact($name, $email, $message); } else { $contact_error = "Please provide a valid name, email, and message."; } } ?>
Positioning organizations for tomorrow through scalable, synergistic, cross-functional excellence.
At Clay Consulting, we leverage cutting-edge strategies to empower businesses across diverse sectors. Harnessing a culture of continuous improvement, we synchronize transformative roadmaps with scalable operational rigor.
Our mission is to deliver scalable solutions that align with tomorrow’s challenges. Through an integrated focus on stakeholder alignment, value acceleration, and enterprise resilience, we enable organizations to convert strategic intent into measurable outcomes.
We orchestrate innovation by embedding data-driven optionality within core processes, ensuring sustainable differentiation and end-to-end lifecycle performance across global value chains.
“Their framework empowered us to pivot, optimize, and accelerate our multi-market engagement model with unparalleled clarity and speed.”— Customer Testimonial
We provide a broad matrix of capability layers engineered to unlock latent enterprise potential and drive multidimensional value capture.
Strategic frameworks and holistic advisory aligning vision with scalable execution across global delivery channels.
End-to-end modernization blueprints catalyzing platform agility, omnichannel integration, and adaptive governance.
Composable cloud migration and interoperability pathways optimizing elasticity and workload orchestration.
Modular architectures unifying stakeholder ecosystems through scalable, service-driven operating layers.
Analytics amplification converting fragmented datasets into predictive intelligence and actionable levers.
Portfolio rationalization and continuous improvement loops reinforcing sustainable ROI horizons.
We have supported Fortune 500 companies in achieving operational efficiency and worked with global partners to streamline innovation pipelines.
Delivered a layered maturity model accelerating cross-silo transparency and compressing decision latency.
Unified prototype gating process with governance telemetry, amplifying throughput and reducing redundancy.
Architected microservice modularity enabling horizontal scale and improving release velocity.
Implemented an insight fabric translating real-time signals into proactive intervention scenarios.
Harmonized multi-region platforms under a unifying interoperability schema.
Developed resilience indices enabling adaptive risk recalibration and continuity acceleration.
We are always seeking talented professionals to join our growing team. If you are passionate about enabling enterprise transformation and shaping scalable value creation, we invite you to express interest.
Submit ResumeReady to explore alignment opportunities? Reach out via the form below.
For engagements, partnerships, or additional information, contact us using the form.
We respond to legitimate business inquiries in a timely manner.