PHP libxml_set_streams_context() Function
The PHP libxml_set_streams_context() function sets the streams context for the next libxml document load or write.
Syntax
libxml_set_streams_context(context)
Parameters
context |
Required. Specify the stream context resource created with stream_context_create() function. |
Return Value
No value is returned.
Example: libxml_set_streams_context() example
The example below shows the usage of libxml_set_streams_context() function.
<?php $opts = array( 'http' => array( 'user_agent' => 'PHP libxml agent', ) ); $context = stream_context_create($opts); libxml_set_streams_context($context); //requesting a file through HTTP $doc = DOMDocument::load('http://www.example.com/file.xml'); ?>
❮ PHP Libxml Reference