Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[WordPress] wp_remote_get で BASIC 認証がかかったページからデータを取得する。
<?php
$user = 'username';
$password = 'password';
$url = 'http://example.com/';
$args = array(
'headers' => array(
'Authorization' => 'Basic '.base64_encode("$user:$password")
)
);
$result = wp_remote_get($url, $args);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.