0

I am using the SabreDAV PHP library to connect to a WebDAV server and download some files but it is taking forever to download a 1MB file and I have to download up to 1GB files from that server. I looked at this link http://code.google.com/p/sabredav/wiki/WorkingWithLargeFiles but it is not helpful because it's telling me that I will get a stream when I do a GET but it is not the case.

Here is my code:

$settings = array(
    'baseUri' => 'file url',
    'userName' => 'user',
    'password' => 'pwd'
);

$client = new \Sabre\DAV\Client($settings);
$response = $client->request('GET'); 

response is an array with a 'body' key that contains the content of the file. What am I doing wrong? I only need the file for read only. How can I can read through the file line by line as quick as possible?

Thanks in advance.

1 Answers1

0

If its taking too long just to download a 1MB file, then I think its not SabreDAV problem but a problem with your server or network, or perhaps the remote server.

The google code link you mentioned just lists a way if you want to transfer very large files, for that you will have to use the stream and fopen way they mentioned, but I think I was able to transfer 1GB files without using that way and just normally when I last used it with OwnCloud.

If you have a VPS/Dedi server, open ssh and use wget command to test the speed and time it takes to download that remote file from WebDAV, if its same as what its taking with SabreDAV, then its a server/network problem and not SabreDAV, else, its a problem with Sabre or your code.

Sorry but I donot have any code to post to help you since the problem itself is not clear and there can be more than 10 things causing it.

PS: You need to increase php limits for execution time, max file upload and max post size too relatively

vongolashu
  • 375
  • 3
  • 17
  • When I download the file using the browser it takes no time. I do not think is a connection problem and my code is exactly the same I showed above. Do you know how to download it the way they mentioned on the Google code? – user3170035 Jan 07 '14 at 19:01
  • @user3170035 I didnt meant in your browse as that will use your net connection and not the network of the server you are running the above code, for that you need to directly download on the server itself using wget/ssh or access the WebDAV file via php to test download speed. Unfortunately, I am not too experienced in SabreDAV and streams yet, I answered the question based as it could be a network problem between servers and not just the code. – vongolashu Jan 08 '14 at 21:10