Saving a remote file from Google Drive?

Permalink
Hi I am using the GoogleDriveAPI to build a podcast, however I am now hitting a wall in that Google Drive doesn't support Byte Range Requests, so i'm thinking is it possible to run a script to save the mp3 files to the concrete5 cache / file manager for say 2 weeks, and serve to apple podcast from there?

At the moment i have this code, but I can't get the remote importer to work.

function saveRemoteFile($fileurl) {
    $token = \Core::make('token')->generate('import_remote');
    # Our image data
    $data = array(
        'ocID' => 0,
        'ccm_token' => $token,
        'url_upload_1' => $fileurl
    );
      # Create a connection
      $url = REL_DIR_FILES_TOOLS_REQUIRED . '/files/importers/remote';
      $curlSession = curl_init($url);
      # Form data string
      $postString = http_build_query($data, '', '&');
      curl_setopt($curlSession, CURLOPT_POST, 1);
      curl_setopt($curlSession, CURLOPT_POSTFIELDS, $postString);

Thanks in advance for any thoughts / advice

BHWW
 
BHWW replied on at Permalink Reply
BHWW
If it helps anyone, i'm getting this response:
HTTP/1.1 200 OK Date: Fri, 26 Jan 2018 16:16:54 GMT Server: Apache Set-Cookie: CONCRETE5=u1brj30ek51bnl4snv7k210msq; path=/; HttpOnly Transfer-Encoding: chunked Content-Type: text/html; charset=UTF-8 Unable to add file


Which looks like its a file permission error:
$fp = FilePermissions::getGlobal();
if (!$fp->canAddFiles()) {
    die(t("Unable to add files."));
}