Page 1 of 1

Error accessing remote file. Please help.

Posted: Wed Feb 20, 2008 2:26 am
by ramki067
Hi,
I'm using the below code for accessing a remote file.

Code: Select all

 
$filelocation = "\\fs-blr-03\str_audio1\Automation\Data_files\playback_automation_datafile_WMA_48kHz_full.txt";
$fp = fsockopen($filelocation, 80, $errno, $errstr, 30);
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: ".$filelocation."\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
    $result .= fgets($fp, 128);
}
fclose($fp);
print $result;
But it giving the following error:

Code: Select all

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\Program Files\Apache Group\Apache2\htdocs\selected_stream.php on line 75
 
Warning: fsockopen() [function.fsockopen]: unable to connect to \\fs-blr-03\str_audio1\Automation\Data_files\playback_automation_datafile_WMA_48kHz_full.txt:80 (Unknown error) in C:\Program Files\Apache Group\Apache2\htdocs\selected_stream.php on line 75
 
Please help.

Thanks,
Ramki.

Re: Error accessing remote file. Please help.

Posted: Wed Feb 20, 2008 7:56 pm
by califdon
Well, it clearly says that the host isn't known. Where is "\\fs-blr-03"? That should be a data source name on your local network. If this script isn't running in the same network where that host was known before, you will have to change it to the correct host name.

Re: Error accessing remote file. Please help.

Posted: Wed Feb 20, 2008 10:04 pm
by ramki067
\\fs-blr-03 is on the local network. I can access from my Windows machine to this local network and open the file.

THanks,
Ramki.

Re: Error accessing remote file. Please help.

Posted: Wed Feb 20, 2008 10:41 pm
by califdon
ramki067 wrote:\\fs-blr-03 is on the local network. I can access from my Windows machine to this local network and open the file.

THanks,
Ramki.
Is it listed in your local Hosts file (usually in C:\WINDOWS somewhere)? In any case, your socket stack isn't aware of it.