Re: cURL Download

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/4/17 Robbert van Andel <robbert@xxxxxxxxx>:
> I've been struggling to download a file from a network file share using
> cURL, or whatever else will work.   All I want to do is get the contents of
> a text file.  But when I run the code below I get this error "Error: 37 -
> Couldn't open file \\server\share\test.txt".  I'm running my website on a
> linux box, but the server is on a Windows file server.  I've verified that
> the file share works when I use Windows Explorer and that the server can get
> the file via the command line using smbclient.  Any help would be
> appreciated.
>
> <?PHP
> $file = "file:\\\\server\\share\\test.txt";
>
>    echo "<p>Getting $file</p>\n";
>
>    // create a new cURL resource
>    $ch = curl_init();
>
>    // set URL and other appropriate options
>    curl_setopt($ch, CURLOPT_URL, $file);
>    curl_setopt($ch, CURLOPT_USERPWD, "username:password");
>    curl_setopt($ch, CURLOPT_HEADER, false);
>
>    // grab file and pass it to the browser
>    echo "<p>File: " . curl_exec($ch) ."</p>\n";
>    echo "<p>Error: " . curl_errno($ch) . " - " . curl_error($ch) .
> "</p>\n";
> ?>
>
> Thanks,
> Robbert
>

Although I can't help you with this I'm pretty sure that cURL does not
have smb support which is the protocol that windows uses for this file
sharing.
Maybe you should try googleling around for something like php smb access.

A quick search turned up with this:

http://www.phpclasses.org/browse/file/20566.html



-- 
Currently developing a browsergame...
http://www.p-game.de
Trade - Expand - Fight

Follow me on twitter!
http://twitter.com/moortier

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux