java中curl命令的等价物
我想要一些帮助,用java编写与下面的curl命令等效的代码
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'cookie: [APP COOKIES];' -d 'sampleFile.json' 'https://url.com'
你可以在下面搜索框中键入要查询的问题!
我想要一些帮助,用java编写与下面的curl命令等效的代码
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'cookie: [APP COOKIES];' -d 'sampleFile.json' 'https://url.com'
# 1 楼答案
使用apache的HttpClient,您可以执行以下操作:
我希望这对你有帮助
编辑:
我添加了发送文件的方式。我输入了一个单独的代码,以避免混合代码(这是一个近似值,基于this examples):