As per mautic developer documentation,I am connecting to mautic basic authorization through custom php using curl locally but it is redirecting me to mautic login page but in my view this is not the correct response.......I want to know whats the correct response of this basic authorization?
$login = 'admin';
$password = '123456';
$url = 'http://127.0.0.1/mautic/'; //localhost
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array(
"Authorization: Basic " . base64_encode($login . ":" . $password)
));
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$result = curl_exec($ch);
print_r(curl_exec($ch));
curl_close($ch);
Also i want to know is Basic Authentication in Mautic different from Oauth2 authorization?
For the reference, here is the Mautic API Basic Auth docs:
https://developer.mautic.org/?php#basic-authentication
And here is how to use it with the PHP Mautic API Library:
https://github.com/mautic/api-library#using-basic-authentication-instead
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With