Skip to content

Instantly share code, notes, and snippets.

@wktdev
Last active July 19, 2020 21:46
Show Gist options
  • Save wktdev/e2ba9b5dd6569920d73676b19722feaf to your computer and use it in GitHub Desktop.
Save wktdev/e2ba9b5dd6569920d73676b19722feaf to your computer and use it in GitHub Desktop.

Built in web server

Go to directory of project

php -S localhost:8000

Get request

$context = stream_context_create(
    array(
        "http" => array(
            "header" => "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36"
        )
    )
);

echo file_get_contents("https://api.github.com/users/wktdev", false, $context);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment