Jump to content

401 Authorization using curl?


siddscool19

Recommended Posts

Try this, it should work for basic HTTP authentication.

 

// Of course, change these:
$url = '...';
$username = 'myname';
$password = '123';

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);

curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "[$username]:[$password]");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.