title: Can I do a CURL request to the same server?
body: <p>I need to implement a way to make POST calls to pages located on the same server or in another server. We cannot use include because the files that we are calling usually call different databases or have functions with the same name. </p>
  
  <p>I've been trying to implement this using curl, and while it works perfectly when calling files from another server, I get absolutely nothing when making a call to the same server where the file is. </p>
  
  <p>EDIT TO ADD SOME CODE:
  A simplified version of what I'm doing:</p>
  
  <p>File1.php</p>
  
  <pre><code>&lt;?php
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, "www.myserver.com/File2.php");
  curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_VERBOSE, true);
  $result = curl_exec($ch);
  curl_close($ch);
  echo $result;
  ?&gt;
  </code></pre>
  
  <p>File2.php</p>
  
  <pre><code>&lt;?php
  echo "I'M IN!!";
  ?&gt;
  </code></pre>
  
  <p>After calling File1.php, I get nothing, but if File2.php is in another server then I get a result.
  Any help?</p>
  
  <p>I tried using both the server URL (http...) and the total address of the files (/home/wwww....)</p>