Created
May 30, 2019 13:00
-
-
Save ryanburnette/0e5fc39a6cc2ba65ffdf11d68f56277a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//https://stackoverflow.com/a/30630753/2535178 | |
$url = 'https://example.com/api/endpoint'; | |
$auth = base64_encode("username:password"); | |
$options = array( | |
'http' => array( | |
'method' => 'POST', | |
'header' => "Authorization: Basic $auth" | |
) | |
); | |
$context = stream_context_create( $options ); | |
file_get_contents( $url, false, $context ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment