2009/4/17 Robbert van Andel <robb...@vafam.com>:
> 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
Maybe you should try googleling around for something like php smb access.

A quick search turned up with this:


Currently developing a browsergame...
Trade - Expand - Fight

Follow me on twitter!

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

Reply via email to