Free 200-550 Exam Braindumps (page: 25)

Page 24 of 56

Which of the following is true about stream contexts? (Choose 2)

  1. A context can modify or enhance the behavior of a stream
  2. A context indicates what session the stream is part of
  3. A context is a set of parameters and stream wrapper specific options
  4. Contexts are created with new Stream_Context();

Answer(s): A,C



Consider the following code. What can be said about the call to file_get_contents?
$getdata = "foo=bar";
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $getdata
)
);
$context = stream_context_create($opts);
$result = file_get_contents('http://example.com/submit.php', false, $context);

  1. A GET request will be performed on http://example.com/submit.php
  2. A POST request will be performed on http://example.com/submit.php
  3. An error will be displayed

Answer(s): B



What function can be used to retrieve an array of current options for a stream context?

  1. stream_context_get_params
  2. stream_context_get_default
  3. stream_context_get_options
  4. The 'options' element of the stream_get_meta_data return value

Answer(s): C



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)

  1. $default_opts = array('http'=>array('user_agent'=>"My Cool Browser")); $default = stream_context_set_default($default_opts);
  2. stream_context_set_option("user_agent", "My Cool Browser");
  3. ini_set('user_agent', "My Cool Browser");
  4. stream_context_set_option($context, "http", "user_agent", "My Cool Browser");

Answer(s): A,C






Post your Comments and Discuss Zend 200-550 exam with other Community members:

200-550 Discussions & Posts