1, CURLOPT_URL => $url ); if ($method == 'POST') { $headers[] = 'Content-Type: application/x-www-form-urlencoded'; $curl_options[CURLOPT_POST] = 1; curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post_params)); } curl_setopt_array($curl, $curl_options); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_USERAGENT, $user_agent); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $curlopt_ssl_verifypeer); // Debug logging \Log::info('CoinGate Request Debug', [ 'url' => $url, 'headers' => $headers, 'auth_token' => substr(self::$auth_token, 0, 10) . '...', 'environment' => self::$environment ]); $raw_response = curl_exec($curl); $decoded_response = json_decode($raw_response, true); $response = $decoded_response ? $decoded_response : $raw_response; $http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if ($method == 'GET') { return $response; } else { return ['response' => $response, 'status_code' => $http_status]; } } }