title: Get output from curl executed in PHP
body: <p>I am using sonicAPI to try and upload a file. For some reason I cannot do this using curl within php because their api requires the flag -F which emulated posting from a form....((HTTP) This lets curl emulate a filled-in form in which a user has pressed the submit button)</p>
  
  <p>Anyway. I have to use </p>
  
  <pre><code>exec("$curl https://api.sonicapi.com/file/upload?access_id=$accessId -Ffile=@./shortaudio.mp3 2&gt;&amp;1", $output, $exit);
  </code></pre>
  
  <p>to upload the file. The command in the quotation marks works when entered directly into a shell. It returns an xml string. However, when I var_dump($output), I just get the 'loading' information that is not actually shown in when executing it in an actual shell. I get this </p>
  
  <pre><code>array(4) {
    [0]=&gt;
    string(79) "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current"
    [1]=&gt;
    string(77) "                                 Dload  Upload   Total   Spent    Left  Speed"
    [2]=&gt;
    string(158) "
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  100 17008  100   249  100 16759    393  26489 --:--:-- --:--:-- --:--:-- 26517"
    [3]=&gt;
    string(249) ""
  }
  </code></pre>
  
  <p>How do I get the xml string that should be returned? The file does get uploaded successfully, so there defo should be an xml response.
  Or, if not, how do I emulate form posting via php curl?</p>