User Login with HTTP Request

I am currently trying to make a script that can send sms messages thru https://www.twilio.com/docs/api/rest/sending-messages . The problem I am currently having is that when i want to make a request, it needs to login per say. If it was curl it would be easy, but alas this is lua. I tried logging like so:



http.Post("https://{SID}:{AuthToken}@api.twilio.com/2010-04-01/Accounts/{SID}/Messages", rest of function)


This did not work. Is there anyway possible to log in thru a lua http request?

Also to those who are wondering, curl says which user it is thru the use of the --user or -u flag. So if you look at the examples on the page linked about you will see.

AFAIK, @ can’t be used in a URL so you’re gonna have to make a PHP based webpage where you can post what you need to, which isn’t hard if you know PHP

I was trying to steer way from it. Im not sure if you can do it the HTTP() global. If not then im truly need to use php as a middle man arg.

-u just sets the Authorization header which you can just add yourself in the http request (it’s base64 username:password, or SID:AuthToken in your case)

I know, but i want to do it in lua. I just stated that so others know exactly what i mean

Did you only read the first 6 words? That’s how you do it with the default http library in gmod