2012-05-10 191 views
2

當我嘗試使用Twilio REST API撥打電話時,出現以下錯誤。Twilio REST API錯誤 - 「驗證」

https://www.twilio.com/docs/api/rest

HTTP/1.1 401 Unauthorized 
Server: nginx 
Date: Thu, 10 May 2012 16:50:48 GMT 
Content-Type: application/xml 
Connection: close 
WWW-Authenticate: Basic realm="Twilio API" 
Etag: 
Last-Modified: 
Content-Length: 233 

401 Authenticate 20003 
http://www.twilio.com/docs/errors/20003 

我用Google搜索,但一無所獲。任何人有這個問題?

我的API調用POST方法是什麼: -

$url = 'https://api.twilio.com/2010-04-01/Accounts/ACdxxxxxxx/Calls'; 

From => +1415xxxxxx 
To => +1646xxxxx 
Url => http://173.201.xx.xx/Test/Twilio/twilio_test.php 
+1

嗨,您需要使用您的帳戶Sid和驗證令牌驗證您的請求。看到這裏的curlopt_userpwd設置:http://php.net/manual/en/function.curl-setopt.php#98164 –

+0

@KevinBurke謝謝,就是這樣。我通過curlopt_userpwd提供了Auth令牌,它工作。 – Sparky

回答

4

(Twilio員工在這裏。)

的401錯誤通常與當你應該來驗證,但沒有或者可能發生錯誤。

您能否提供您用來發出呼叫的完整代碼片段?您是否使用我們的示例代碼片段或其他內容?

1

你的Sid和Token必須是錯的。檢查你的配置文件。