Consider the following code:
<?php $result = file_get_contents("http://www.bogus.com", false, stream_context_create( array( "http" => array( "method" => "POST", "header" => "Content-type: application/x-www-form-urlencoded", "content" => base64_encode("This is the payload") ) ) ) ); ?>
What will happen when it is executed?
A: A POST request will be performed.
B: You can't POST data this way:
file_get_contents() is for getting not posting. Use the cURL extension if you want to post data to a server.
C: A POST request is attempted but the server returns status code 500 because the given payload was not encoded as stated in the
D: The call to
file_get_contents() will raise an error.
E: There are no second and third parameters to
file_get_contents(), so these will be ignored an a GET request will be performed.