我正在尝试使用R通过Twilio发送短信。以下代码有效但发送短信后,它会尝试保留连接选项。
library(RCurl)
Twilio_Account_SID <- "YourKey"
Twilio_Account_TOKEN <- "YourToken"
Number_From <- "+44*********"
Number_To <- "+44*********"
the_url <- paste("https://api.twilio.com/2010-04-01/Accounts/",
Twilio_Account_SID,"/Messages.XML",sep="")
output <- postForm(the_url,
.opts = list(
userpwd = paste(Twilio_Account_SID,":",Twilio_Account_TOKEN,sep=""),
useragent = "RCurl",
verbose = TRUE
),
.params = c(From = Number_From,
To = Number_To,
Body = "I am sending a test message"
)
)
然后我收到这条消息:
< Connection: keep-alive
<
* Connection #1 to host api.twilio.com left intact
Error: UNAUTHORIZED
你有什么想法解决这个问题吗?