6

I am able to implement http basic auth in wp_remote_get using the following code

$args = array(
    'headers' => array(
        'Authorization' => 'Basic ' . base64_encode( $username . ':' . $password )
    )
);
wp_remote_request( $url, $args );

Is it possible to do http digest based authentication using wp_remote_get function?

2 Answers 2

4

It is possible to do HTTP DIGEST authentication with wp_remote_get(), but it's somewhat complicated. I've written a short wrapper function you can use.

1
0

Isn't that obvious? wp_remote_get is just a single request response function. The difference, as far as wp_remote_get is concerned is that basic authentication is just one request response and hence just one call to wp_remote_get.

For digest based authentication, you have to make four request-response = four wp_remote_get calls.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.