Exam4Training

When retrieving data from URLs, what are valid ways to make sure all file_get_contents calls send a certain user agent string? (Choose 2)

When retrieving data from URLs, what are valid ways to make sure all file_get_contents calls send a certain user agent string? (Choose 2)
A . $default_opts = array(‘http’=>array(‘user_agent’=>"My Cool Browser")); $default= stream_context_set_default($default_opts);
B . stream_context_set_option("user_agent", "My Cool Browser");
C . ini_set(‘user_agent’, "My Cool Browser");
D . stream_context_set_option($context, "http", "user_agent", "My Cool Browser");

Answer: A, C

Exit mobile version