-3

curl for Twilio with out helper library

curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/[sid]/Messages.xml' \
--data-urlencode 'To=+919400xxxxxx'  \
--data-urlencode 'From=+1484925xxxx'  \
--data-urlencode 'Body=[body]' \
-u [sid]:[AuthToken]

I wanted to Do it using C# code. ( I don't have much knowledge in C# )

I just checked these

  1. Making a cURL call in C#
  2. cURL with user authentication in C#

But gives invalid request.

Community
  • 1
  • 1
Arjun Raj
  • 984
  • 2
  • 12
  • 32
  • Do you seriously think that "I don't have much knowledge in C#" is a good justification for being lazy? – zerkms Nov 08 '14 at 11:20
  • What is your question? Do you want to call curl from C# or do you want to make that web request directly in C#? – delixfe Nov 08 '14 at 11:22
  • @zerkms I am a PHP developer. During college days I just did some C# ( about 5 years ago ). Now I accidentally met a situation to use Twilio on a ASP project. I tried something but it not work much... – Arjun Raj Nov 08 '14 at 11:28
  • @delixfe I want to make that web request directly. – Arjun Raj Nov 08 '14 at 11:29
  • @Arjun Raj: if it's a paid project - then just don't apply on something you cannot handle. If it's an educational project - learn how to program C#. Either way, asking us to code for you for free makes little to no sense. – zerkms Nov 08 '14 at 11:40
  • That usage of `curl` makes an HTTP POST request with a set of arguments. You can also do this using C#, however it will have nothing to do with `curl`, per se. Take a look at [this question](http://stackoverflow.com/questions/7908972/how-to-write-a-http-request). – Drew Noakes Nov 08 '14 at 11:44
  • You should write more about what you already have tried. Show your code and the errors you have gotten. Then it will be easier for us to help you. – delixfe Nov 08 '14 at 12:42

1 Answers1

3

You can start by using Nuget to download the Twilio helpers, search for Twilio. Once you have that package installed, you can use it like this.

var client = new TwilioRestClient("accountsid", "authtoken");
var result = client.SendSmsMessage("from", "to", "body");
Devin Rader
  • 10,260
  • 1
  • 20
  • 32
Louis Lewis
  • 1,298
  • 10
  • 25