Skip to content

Instantly share code, notes, and snippets.

@Marlinc

Marlinc/test.php Secret

Last active April 3, 2016 12:34
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 Marlinc/56de143a61f44acdf76a06d8da8e7e04 to your computer and use it in GitHub Desktop.
Save Marlinc/56de143a61f44acdf76a06d8da8e7e04 to your computer and use it in GitHub Desktop.
<?php
// Set up
StreamWrapper::overrideWrapper('http');
StreamWrapper::emulate(HttpEmulation::fromCallable(function () {
return new Response(200, [], 'Test123');
}));
var_dump(file_get_contents('http://example.com'));
// Output: string(7) "Test123"
// Tear down:
StreamWrapper::restoreWrapper('http');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment