Skip to content

Instantly share code, notes, and snippets.

@pcrov
Created September 9, 2016 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcrov/8850281697bcb517071b87c59a6809dd to your computer and use it in GitHub Desktop.
Save pcrov/8850281697bcb517071b87c59a6809dd to your computer and use it in GitHub Desktop.
<?php declare(strict_types = 1);
class simple_filter extends php_user_filter {
function filter($in, $out, &$consumed, $closing) {
while ($bucket = stream_bucket_make_writeable($in)) {
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
}
stream_filter_register("simple", "simple_filter");
file_get_contents("php://filter/read=simple/resource=http://google.com");
// Warning: file_get_contents(): Filter failed to process pre-buffered data in scratchpad.php on line 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment