Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Test get_headers() function : test with context --FILE-- <?php include __DIR__."..

Decoded Output download

--TEST--
Test get_headers() function : test with context
--FILE--
<?php

include __DIR__."/../../../../sapi/cli/tests/php_cli_server.inc";
php_cli_server_start('header("X-Request-Method: ".$_SERVER["REQUEST_METHOD"]);');

$opts = array(
  'http' => array(
    'method' => 'HEAD'
  )
);

$context = stream_context_create($opts);
$headers = get_headers("http://".PHP_CLI_SERVER_ADDRESS, 1, $context);
echo $headers["X-Request-Method"]."
";

stream_context_set_default($opts);
$headers = get_headers("http://".PHP_CLI_SERVER_ADDRESS, 1);
echo $headers["X-Request-Method"]."
";

echo "Done";
?>
--EXPECT--
HEAD
HEAD
Done

Did this file decode correctly?

Original Code

--TEST--
Test get_headers() function : test with context
--FILE--
<?php

include __DIR__."/../../../../sapi/cli/tests/php_cli_server.inc";
php_cli_server_start('header("X-Request-Method: ".$_SERVER["REQUEST_METHOD"]);');

$opts = array(
  'http' => array(
    'method' => 'HEAD'
  )
);

$context = stream_context_create($opts);
$headers = get_headers("http://".PHP_CLI_SERVER_ADDRESS, 1, $context);
echo $headers["X-Request-Method"]."\n";

stream_context_set_default($opts);
$headers = get_headers("http://".PHP_CLI_SERVER_ADDRESS, 1);
echo $headers["X-Request-Method"]."\n";

echo "Done";
?>
--EXPECT--
HEAD
HEAD
Done

Function Calls

None

Variables

None

Stats

MD5 989157af956983ad1bcd402eba7b42d8
Eval Count 0
Decode Time 93 ms