简体   繁体   中英

stream_context_get_params() in PHP 5.2.6

could you help me please with this problem:

i need to use this function stream_context_get_params() but it is available only from PHP 5.3 or bigger. Our server is PHP 5.2.6 and gives the following error: *Fatal error: Call to undefined function stream_context_get_params()*

I have searched the internet but there's nothing related with this

Is there any similar function like this one for older versions or maybe there is a workaround?

I highly doubt there will be a way to mimic this function. You would have to look for a library that does streaming, but I would just upgrade to PHP 5.3. By far the easiest.

Its not realy a replacement for the function you are missing, but you can get options of a context also with:

stream_context_get_options

I think the only thing whats missing in the results is the stream_notification_callback so this should help you:

if(function_exists("stream_context_get_params")) {
  function stream_context_get_params($stream_or_context) {
    return array("options"=>stream_context_get_options($stream_or_context));
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM