Memo

メモ > 技術 > プログラミング言語: PHP > file_get_contentsでBasic認証を扱う

■file_get_contentsでBasic認証を扱う
PHP:file_get_contentsでBasic認証する https://salumarine.com/basic-authentication-with-file_get_contents-in-php/
<?php $opts = [ 'http' => [ 'method' => 'GET', 'header' => 'Authorization: Basic ' . base64_encode('username:password') ] ]; echo file_get_contents('http://localhost/~test/request/target.php', false, stream_context_create($opts));

Advertisement