So this is what I have so far:
self::$connection = curl_init();
curl_setopt(self::$connection, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt(self::$connection, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt(self::$connection, CURLOPT_URL, $url);
curl_exec(self::$connection); // Do a request that uses Basic Auth
curl_setopt(self::$connection, CURLOPT_HTTPAUTH, false); // <-- Not working as expected - I want to disable Basic Auth here
curl_setopt(self::$connection, CURLOPT_URL, $anotherURL);
curl_exec(self::$connection); // <-- Not working as expected - I want to do a request that does NOT use Basic Auth.
So, if I initialized the CURLOPT_HTTPAUTH option to CURLAUTH_BASIC, how would I go about disabling it?
I need to use the same handle (that is self::$connection) in order to have a persistent HTTP connection.
If it helps anyone, this is what I ended up doing:
Basically I just manually enable/disable Basic Auth using the CURLOPT_HTTPHEADER option.