title: Getting a 404 while using PHP Curl but can visit the url
body: <p>I'm trying to use curl to get data from a specific website and am getting a 404 as response. The curious thing is that i can visit the url just fine.</p>
  
  <p>I guess the problem lies elsewhere (likely with my malformed request to start with) and was wondering if someone could shed some light:</p>
  
  <pre><code>    ...
      curl_setopt($ch, CURLOPT_TIMEOUT, 30);
      curl_setopt($ch, CURLOPT_USERAGENT, 'my own agent');
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
      curl_setopt($ch, CURLOPT_URL, $url);
      if (! empty($data)) {
          curl_setopt($ch, CURLOPT_POST, 1);
          curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
      }
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($ch, CURLOPT_COOKIEJAR, 'c4l.cookie');
      $output['returned'] = curl_exec($ch);
      $output['info'] = curl_getinfo($ch);
  
      return $output;
  </code></pre>
  
  <p>PS: The above code was not written by me nor I'm that good with PHP but I need to need to debug and find whatever is causing the error.</p>
  
  <p>Any help would be much appreciated.</p>
  
  <p><strong>EDIT:</strong> </p>
  
  <p>The url is: <code>http://www.example.com/something/else/here.also</code></p>
  
  <p><strong>EDIT2:</strong></p>
  
  <p>The actual response is:</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;
  &lt;HTML&gt;&lt;HEAD&gt;
  &lt;TITLE&gt;404 Not Found&lt;/TITLE&gt;
  &lt;/HEAD&gt;&lt;BODY&gt;
  &lt;H1&gt;Not Found&lt;/H1&gt;
  The requested URL /something/else/here.also was not found on this server.&lt;P&gt;
  &lt;HR&gt;
  &lt;ADDRESS&gt;Oracle-Application-Server-10g/10.1.3.5.0 Oracle-HTTP-Server     Server at cbl08901app01.nat.bt.com Port 61000&lt;/ADDRESS&gt;
  &lt;/BODY&gt;&lt;/HTML&gt;
  </code></pre>