title: cURL changing the URL after POST
body: <p>I am doing an HTTP POST using cURL</p>
  
  <pre><code>$url = "http://localhost:8080/~demo/cgi-bin/execute/100";
  
  //open connection
  $ch = curl_init();
  
  //set the url, number of POST vars, POST data
  curl_setopt($ch,CURLOPT_URL,$url);
  curl_setopt($ch,CURLOPT_POST,count($data));
  curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
  
  //execute post
  $result = curl_exec($ch);
  echo("$result");
  //close connection
  curl_close($ch);
  </code></pre>
  
  <p>The post gets executed, but the response is shown with the error:</p>
  
  <blockquote>
    <p><strong>The requested URL /~demo/100 was
    not found on this server</strong>.</p>
  </blockquote>
  
  <hr>
  
  <p>The above URL, obviously, does not exist not the server because (somehow) cURL has changed the URL.</p>
  
  <p>It should have been <code>/~demo/cgi-bin/execute/100</code> . This URL works in browser.</p>
  
  <p>Please tell me why does it do that?
  AND how can i stop this, for what I want?</p>