Avatar of esak2000
esak2000 asked on

convert curl to c# code

How do I convert the following curl code to c#?


curl -X POST -H "Content-type: application/json" -H "Authorization: BeGlobal apiKey=<YOUR API KEY>" -d '{"text":"Hello Developers", "from":"eng", "to":"fra"}' https://api.beglobal.com/translate

Open in new window

C#.NET Programming

Avatar of undefined
Last Comment
esak2000

8/22/2022 - Mon
Dave Baldwin

It is unlikely that you will be able to duplicate cURL functions in C# but you can apparently link to 'libcurl.dll' which does the important work.  This page has a link to a project ( http://thedotnetframework.blogspot.com/2008/06/lets-talk-about-http-protocol-and-http.html ) and some info about using the dlls.  http://stackoverflow.com/questions/4925057/libcurl-dll-problem-with-curl-and-c-sharp-net
ASKER CERTIFIED SOLUTION
esak2000

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Dave Baldwin

Before you try to connect to an API, try to use a simple cURL procedure that just GETs a web page to make sure the basic code and dlls are working.
ASKER
esak2000

The above code worked, the authorization was something that needed to be worked on with the provider's API
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck