Return to stream_context_set_option_basic.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / streams |
1.1 misho 1: --TEST-- 2: stream_context_set_option() function - basic test for stream_context_set_option() 3: --CREDITS-- 4: Jean-Marc Fontaine <jean-marc.fontaine@alterway.fr> 5: # Alter Way Contribution Day 2011 6: --FILE-- 7: <?php 8: $context = stream_context_create(); 9: 10: // Single option 11: var_dump(stream_context_set_option($context, 'http', 'method', 'POST')); 12: 13: // Array of options 14: $options = array( 15: 'http' => array( 16: 'protocol_version' => 1.1, 17: 'user_agent' => 'PHPT Agent', 18: ), 19: ); 20: var_dump(stream_context_set_option($context, $options)); 21: 22: var_dump(stream_context_get_options($context)); 23: ?> 24: --EXPECT-- 25: bool(true) 26: bool(true) 27: array(1) { 28: ["http"]=> 29: array(3) { 30: ["method"]=> 31: string(4) "POST" 32: ["protocol_version"]=> 33: float(1.1) 34: ["user_agent"]=> 35: string(10) "PHPT Agent" 36: } 37: }