Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将此curl POST请求更改为c#代码_C#_Visual Studio_Curl_Http Post - Fatal编程技术网

如何将此curl POST请求更改为c#代码

如何将此curl POST请求更改为c#代码,c#,visual-studio,curl,http-post,C#,Visual Studio,Curl,Http Post,我正在尝试使用C#发出HTTP POST请求,我只知道以下几点: 我有一个纯文本模板。他们建议将其存储在一个单独的文件中,这样更容易传递到请求。下面是一个示例,如果模板位于名为expensify_template.txt的文件中,则应调用: curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' \ -d 'requestJobDescription={....}

我正在尝试使用C#发出HTTP POST请求,我只知道以下几点:

我有一个纯文本模板。他们建议将其存储在一个单独的文件中,这样更容易传递到请求。下面是一个示例,如果模板位于名为
expensify_template.txt的文件中,则应调用:

curl -X POST 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations' \
    -d 'requestJobDescription={....}' \
    --data-urlencode 'template@expensify_template.txt'

我必须使用Visual Studio编写一个代码,通过c#发送该请求。答案是-具体地说是方法a,其中表示
var content=new FormUrlEncodedContent(values)其中的值将是读取包含模板的文本文件的结果。

我知道如何仅使用post发送HTTP请求,直到到达--data urlencode,我已经发送了以下部分:curl-X post'\-d'requestJobDescription={…}'我遇到了一个问题:\--data urlencode'template@expensify_template.txt答案仍然在链接的帖子中——特别是方法A,上面写着
var content=new FormUrlEncodedContent(value)
其中
将是您读取包含模板的文本文件的结果。不过,我会删除可能重复的评论,因为这个问题与您的问题没有具体关系。非常感谢您,这真的很有帮助!!不客气:)如果你想接受的话,我会把它写在回信里。