Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> mam problem z odczytaniem pliku z innego serwera
grohoo
post
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 11.09.2002
Skąd: osztyn

Ostrzeżenie: (0%)
-----


mam problem z odczytaniem pliku z innego serwera.uzywajac
do tego:
$filename="http://www.free.of.pl/s/szparag/faq.htm";
$file=fopen($filename,"r");
$dlugosc=filesize($filename);
$fstring=fread($file,$dlugosc);

wysakuje blad:

Warning: stat failed for http://www.free.of.pl/s/szparag/faq.htm (errno=2 - No such file or directory) in /shells/szparag/html/test.php on line 19

jesli ktos wie,jak odczytac plik ze zdalnego serwera to prosze o pomoc.


--------------------
grohoo
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
talee
post
Post #2





Grupa: Zarejestrowani
Postów: 105
Pomógł: 0
Dołączył: 7.09.2002
Skąd: Bydgoszcz

Ostrzeżenie: (0%)
-----


Cytat
...
int filesize ( string filename)
...
This function will not work on remote files; the file to be examined must be accessible via the server's filesystem.


Polecam manual do php
Go to the top of the page
+Quote Post
Coondelboory
post
Post #3





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 4.09.2002

Ostrzeżenie: (0%)
-----


>$filename="http://www.free.of.pl/s/szparag/faq.htm";
>$file=fopen($filename,"r");
>$dlugosc=filesize($filename);
>$fstring=fread($file,$dlugosc);

powinno byc:

$filename="http://www.free.of.pl/s/szparag/faq.htm";
$file=fopen($filename,"r");
$fstring="";
while (!feof($file)) $fstring.=fread($file,128);

zamiast 128 mozesz wstawic cokolwiek innego

C.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 20:39