2012-05-10 202 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必须是错的。检查你的配置文件。