title: How to copy file from google drive to another server using php
body: <p>I want to copy file from google drive to another server using php. </p>
  
  <p>I have used google drive picker and when user clicks on any file I used to get download url, I was thinking that it can be done through copy function, but it didn't work. </p>
  
  <p>Any solution Please.</p>
  
  <pre><code>function getDownloadurl(fileId) {
             var request =  gapi.client.request({
                      'path': '/drive/v2/files/' + fileId,
                      'params': { 'maxResults': '1000' },
                      callback: function (responsejs, responsetxt) {
                      var fileDownloadUrl = responsejs.downloadUrl; 
                $.ajax({
                  type: "POST",
                  url: "ajax-files/copy_drive_file.php",
                  data: { gd_url:fileDownloadUrl },
                  async:false,
                  success: function(data)
                  {   
  
                  }
  });
  </code></pre>
  
  <p><strong>copy_drive_file.php</strong></p>
  
  <pre><code>$sourcePath=$_POST['gd_url'];
  copy($sourcePath, 'sss/file.jpg'); 
  </code></pre>