Closed RosiersRobin closed 6 years ago
It needs Digest authentication
Hi Robin
In the "base" curl request, you use the CURLAUTH_DIGEST
constant, whereas in the ixudra/curl request, you use a string which contains the value 'CURLAUTH_DIGEST'. These are two completely different things. Try again like this:
$response = Curl::to($url)
->withOption('USERPWD', $username . ":" . $password)
->withOption('HTTPAUTH', CURLAUTH_DIGEST)
->withOption('RETURNTRANSFER', 1)
->withOption('FOLLOWLOCATION', 1)
->get();
You can simplify even more like this:
$response = Curl::to($url)
->withOption('USERPWD', $username . ":" . $password)
->withOption('HTTPAUTH', CURLAUTH_DIGEST)
->allowRedirect()
->get();
since CURLOPT_RETURNTRANSFER
is set to true
by default and the allowRedirect()
method is basically a more readable way to set the CURLOPT_FOLLOWLOCATION
Hope this helps.
Closed due to inactivity
So I have written this code
And it throws the error that I'm not authenticated... Now the "bare" Curl code is the following:
What am I doing wrong here?