通过休息Api进行Mautic基本认证

Muh*_*zad 6 php curl basic-authentication mautic

根据mautic开发人员文档,我通过本地使用curl通过自定义php连接到mautic基本授权,但它将我重定向到mautic登录页面,但在我看来这不是正确的响应.......我想知道什么是这个基本 授权的正确回应?



    $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);

Run Code Online (Sandbox Code Playgroud)

另外我想知道Mautic中的基本身份验证与Oauth2授权有什么不同?

Joh*_*art 1

作为参考,这里是 Mautic API 基本身份验证文档:

https://developer.mautic.org/?php#basic-authentication

以下是如何将其与 PHP Mautic API 库一起使用:

https://github.com/mautic/api-library#using-basic-authentication-instead