title: Delete file from second server via first server via php
body: <p>I have two servers. I want delete file from second server via first server! </p>
  
  <p>For example:</p>
  
  <ul>
  <li>first-server.com</li>
  <li>second-server.com</li>
  </ul>
  
  <p>I have made two php files - file on first server and file on second server.</p>
  
  <p>The file on first server contains</p>
  
  <p>files.php</p>
  
  <pre><code>while($file = mysql_fetch_array($files){
  echo $file['file_name'];
  echo '&lt;a href="second_server.com/delete.php?file=' . $file['file_name'] . '"&gt;Delete&lt;/a&gt;';
  }
  </code></pre>
  
  <p>the file on second server contains </p>
  
  <p>delete.php</p>
  
  <pre><code>if($_GET['file']){
  if(file_exists($_GET['file']){
  unlink($_GET['file'];
  //file deleted !
  }
  </code></pre>
  
  <p>No it's ok , but. I want done this job without redirect me or visitor to the second server</p>
  
  <p>For example : ajax or curl or something like that. What is the best way to do that? </p>
  
  <hr>
  
  <p>Edit. </p>
  
  <p>The codes above is just tests. It's not my real files. Please help in the way to process delete request without redirect to second server php file. </p>