使用PHP进行cURL身份验证

时间:2016-01-10 10:51:57

标签: php authentication curl

我需要在我的基本PHP应用程序中使用cURL建立身份验证。我尝试使用Springboard Retail API进行身份验证。

他们的文档可以在这里找到:dev.springboardretail.com,表示以下使用cURL进行身份验证的代码:

curl -c cookiefile -b cookiefile -dauth_key={{username}}\&password={{password}} "https://{{subdomain}}.myspringboard.us/api/auth/identity/callback" 

我似乎无法找到有关如何实施上述代码的信息。这是我的尝试:

<?php
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_COOKIEFILE, 'dauth_key={{username}}\&password={{password}}');
    curl_setopt ($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

    $url = 'https://{{subdomain}}.myspringboard.us/api/auth/identity/callback';

    $result = curl_exec ($curl);
    curl_close ($curl);
    print $result;
?>

由于我没有cURL和基本PHP技能的经验,请提供您的任何意见或建议。谢谢!

0 个答案:

没有答案