I’m developing a plugin which has an upgrade option. After the customer purchases the plugin from my sales site (also running WordPress), they get a download key and download URL generated by Shopp. For example:
$url = 'https://mysalessite.com/products/account/download/5cad290d109a519cdbdb6197307bd378ae1aa25f/';
I’d like the client to be able to enter their user name, password, and download key into the plugin options and receive the upgrade package automatically. But, obviously, when I use:
$response = wp_remote_request( $url );
var_dump( $response );
The only thing that is returned is the login screen, since the user isn’t logged in.
I stumbled upon the suggestion at http://lud.icro.us/wordpress-http-api-basicauth, and tried using
$args = array(
'headers' => array(
'Authorization' => 'Basic ' . base64_encode( 'username:passw0rd' )
)
);
$response = wp_remote_request( $url, $args );
But it still returns a login screen in $response
, not the purchased file.