Twilio cURL result in Authentication Error - No credentials provided
<p>I'm struggling with sending a msg from your twilio api, I tested your demos that exists on the twilio website on my local server with the following features:
host : (i686-pc-linux-gnu)
libcurl php version: 7.35.0
ssl version: OpenSSL/1.0.1f.</p>

<p>It works my local server but on this server with the following features :
host : x86_64-redhat-linux-gnu
libcurl php version : 7.19.7
ssl version: NSS/3.19.1 Basic ECC 
it didn't work.
Here's the output of the curl request to the twilio api:</p>

<p>{"code": 20003, "detail": "Your AccountSid or AuthToken was incorrect.", "message": "Authentication Error - No credentials provided", "more_info": "<a href="https://www.twilio.com/docs/errors/20003" rel="nofollow">https://www.twilio.com/docs/errors/20003</a>", "status": 401}1</p>

<p>the code:</p>

<pre><code>&lt;?php
//my trial account sid, and token
$sid = "XXXXXXXXXXXX"; // Your Account SID from www.twilio.com/user/account
$token = "XXXXXXXXXXXXX"; // Your Auth Token from www.twilio.com/user/account

function send_sms( $sid, $token, $to, $from, $body ) {
    // resource url &amp; authentication
    $uri = 'https://api.twilio.com/2010-04-01/Accounts/' . $sid . '/SMS/Messages.json';
    $auth = $sid . ':' . $token;

    // post string (phone number format= +15554443333 ), case matters
    $fields = 
        '&amp;To=' .  urlencode( $to ) . 
        '&amp;From=' . urlencode( $from ) . 
        '&amp;Body=' . urlencode( $body );

    // start cURL
    $res = curl_init($uri);

    // set cURL options
    curl_setopt( $res, CURLOPT_POST, TRUE ); 
    curl_setopt( $res, CURLOPT_RETURNTRANSFER, TRUE ); // don't echo
    curl_setopt( $res, CURLOPT_SSL_VERIFYPEER, FALSE );
    curl_setopt( $res, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
    curl_setopt( $res, CURLOPT_USERPWD, $auth ); // authenticate
    curl_setopt( $res, CURLOPT_POSTFIELDS, $fields );


    // send cURL
    $result = curl_exec( $res );
    curl_close($res);
    return $result;
}
echo send_sms($sid,$token,"+XXXXXXXX","+XXXXXXXXXXXXXX","TESTING");
?&gt;
</code></pre>

<p>I hope you know what is the problem but I think it's related to the ssl version, that included with the php curl extention on the server.</p>

<p>PS: I have no access to the second server so that I cannot upgrade the libcurl extention to the latest version, which I think the reason of the problem.</p>