I'm trying to create a script that backsup all the documents of a user. Everything works fine for text documents but when comes to spreadsheets, the content I have is 401 Unauthorized.
Anyone knows why this is happening?
Here is a bit of code I'm using:
foreach($feeds as $item)
{
$saveFilePath = $save_path . '/' . $item->getTitle() . "." . $docType["format"];
$uri = $item->getContent()->getSrc() . "&exportFormat=" . $docType["format"]);;
$data = $docs
->getHttpClient()
->setUri($uri)
->request()
->getBody();
$fp = fopen($saveFilePath, "wb");
fwrite($fp, $data);
fclose($fp);
}
Thanks