开发者

Mixing CURL with Objective C

开发者 https://www.devze.com 2023-02-12 22:32 出处:网络
I am working with the Let\'s Crate API, it uses basic Auth and it gives examples on how to use it in CURL:

I am working with the Let's Crate API, it uses basic Auth and it gives examples on how to use it in CURL:

Takes file and crate_id as parameters. file is the file data. E.g. curl -F file=@filename.txt -F crate_id=123 https://api.letscrate.com/1/files/upload.json

But I have never used CURL before, so how would i make my Mac application when the API involves CURL, I know this is most likely a very simple, question, but I think the fact that I have never used CURL before is confusing me.

I can get it to work using terminal by using this:

curl -u <username:password> -F file=@<filename> -F crate_id=<crate ID(number)> https://api.letscrate.com/1/f

but i want the user to login, and then just开发者_高级运维 click upload and select the file they want, and then send it, nothing overly hard, i just don't know how to get the CURL to play nice with the Objective C.

Thanks in advance, I hope you can help.


You need to use libcurl if you want CURL within an Objective-C application. libcurl is CURL's library and, since it's written in C it plays nicely with Objective-C.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号