Error accessing remote file. Please help.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ramki067
Forum Newbie
Posts: 4
Joined: Wed Feb 20, 2008 2:25 am

Error accessing remote file. Please help.

Post 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.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Error accessing remote file. Please help.

Post 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.
ramki067
Forum Newbie
Posts: 4
Joined: Wed Feb 20, 2008 2:25 am

Re: Error accessing remote file. Please help.

Post 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.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Error accessing remote file. Please help.

Post 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.
Post Reply