function someFunction(){ $context = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0]['file']; $currentContext = stream_context_get_params(stream_context_get_default()); echo $currentContext."|".$context; } someFunction();
function someOtherFunction(){ $context = stream_context_get_default(); $ssl = stream_context_get_options($context)['ssl']; $cafile = $ssl['cafile']; } someOtherFunction();This example uses the `stream_context_get_default` function to retrieve the current context and the `stream_context_get_options` function to retrieve the SSL options. It then obtains the CA file from the SSL options. This code requires no additional package library.