Допустим, есть ссылка вроде https://evilinside.ru/admin/post-new.php?attempt=1. Как убрать из неё всё, что идёт после знака вопроса? Сразу предлагаю рассмотреть самый простой…
You will need to add a stream context to get the extra data in your request. Try something like the following untested code. It’s based on one of the examples on the PHP documentation for file_get_contents()
:
$auth = base64_encode("username:password");
$context = stream_context_create([
"http" => [
"header" => "Authorization: Basic $auth"
]
]);
$homepage = file_get_contents("http://example.com/file", false, $context );