title: C++ rest sdk POST form data json
body: <p>Is it possible to post "form data" whith C++ rest SDK (Casablanca)? I have a given web service which looking for post data in "form data", not in the body.</p>
  
  <p>This is the C++ code:</p>
  
  <pre><code>http_client client(L"http://localhost/posttest/jsontest.php");
  
  // Manually build up an HTTP request with header and request URI.
  http_request request(methods::POST);
  request.headers().add(L"Content-Type", L"application/json");
  request.headers().add(L"Content-Length", L"100");
  request.headers().add(L"Host", L"example.com");
  request.headers().add(L"X-Requested-With", L"XMLHttpRequest");
  request.set_body(obj);
  return client.request(request).then([id](http_response response)
  {
      if (response.status_code() == status_codes::OK)
      {
          return response.extract_json();
      }
      else {
          /* Print bad status code */
          wcout &lt;&lt; L"Server returned returned status code " &lt;&lt; response.status_code() &lt;&lt; L'.' &lt;&lt; std::endl;
      }
      return pplx::task_from_result(json::value());
  })
  </code></pre>
  
  <p>The web service can only use data like this (I can't modify it):</p>
  
  <pre><code>$arr = [$_POST['code']];
  header('Content-Type: application/json');
  echo json_encode($arr);
  </code></pre>
  
  <p>(This is just a sample PHP code, what I use for testing)</p>