Note that there are some explanatory texts on larger screens.

plurals
  1. POwindows cURL cmd and multiline
    text
    copied!<p>I have installed cURL command line for windows.</p> <p>Now I want to use this cURL for a REST api (redmine).</p> <p>The most basic script I want to create is to push a new "past". But the problem is, one past can contains multiline text.</p> <p>To put a new past I use:</p> <pre><code>curl -k -s -H "X-Redmine-API-Key: %API_KEY%" --data-urlencode "paste[text]=%TEXT%" %URL% </code></pre> <p>But the problem is when %TEXT% is composed by more than one line, the windows cmd failed.</p> <p>Ex:</p> <pre><code>curl -k -s -H "X-Redmine-API-Key: XXXXXX" --data-urlencode "paste[text]=ST_METHOD_POST', 'POST', true); define('HTTP_REQUEST_METHOD_PUT', 'PUT', true); define('HTTP_REQUEST_METHOD_DELETE', 'DELETE', true);" "https://etc" </code></pre> <p>And cmd stops after the first newline...</p> <p>I try parse TEXT before running cmd by adding ^ at the end of the line to simulate multiline win cmd but does not work...</p> <hr> <p><strong>Update 1:</strong></p> <p>I try </p> <pre><code>curl -k -s -H "X-Redmine-API-Key: %API_KEY%" --data-urlencode "paste[text]@tmp.txt" %URL% </code></pre> <p>where tmp.txt equals to</p> <pre><code>hello world </code></pre> <p>but the request is transformed to</p> <pre><code>{"paste":{"id":xxx,"author_id":xxx,"project_id":xxx,"title":"Paste #xxx","text":"  ■h\u0000e\u0000l\u0000l\u0000o\u0000 \u0000w\u0000o\u0000r\u0000l\u0000d\u0000", "created_on":"2012-11-26T09:24:15Z","updated_on":"2012-11-26T09:24:15Z"}} </code></pre> <p>And the final result does not work</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload