Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php]socket, fread, bufor
-gog-
post 14.03.2008, 19:15:54
Post #1





Goście







dopiero zaczynam i juz mam problem ktory dla mnie jest nie do przeskoczenia..

oto kod
Kod
<?php
$fp=fsockopen("wp.pl", 80);
fwrite($fp, "GET /index.php HTTP/1.1
User-Agent: Opera/9.50 (Windows NT 5.1; U; en)
Host: wp.pl
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: pl-PL,pl;q=0.9,en;q=0.8
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: deflate, identity, *;q=0
Cache-Control: no-cache
Connection: Keep-Alive, TE
TE: deflate, gzip, chunked, identity, trailers
");

ob_start();
echo fread($fp, 9000);
$dane2 = ob_get_contents();
   $file = "wp.txt";
   $fp = fopen($file, "a+");
   fwrite($fp, stripslashes($dane2));
   ob_end_clean();
fclose($fp);
?>


Wszystko dziala z jedym ale, czyta tylko te 9000 znakow czy bajtow whatever, jak zrobic zeby czytalo do konca?
Go to the top of the page
+Quote Post
jacus24
post 14.03.2008, 19:23:01
Post #2





Grupa: Zarejestrowani
Postów: 133
Pomógł: 0
Dołączył: 15.12.2007

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


Zamiast fread użyj file albo readfile.

Ten post edytował jacus24 14.03.2008, 19:29:04
Go to the top of the page
+Quote Post
-Gość-
post 14.03.2008, 19:40:10
Post #3





Goście







yyyy moglbys napisac jak to ma wtedy wygladac bo cos mi nie wychodzi..
Go to the top of the page
+Quote Post
jacus24
post 14.03.2008, 19:49:06
Post #4





Grupa: Zarejestrowani
Postów: 133
Pomógł: 0
Dołączył: 15.12.2007

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


chyba tak
  1. <?php
  2. echo readfile($fp);
  3. $dane2 = ob_get_contents();
  4.  $file = "wp.txt"; 
  5.  $fp = fopen($file, "a+"); 
  6.  fwrite($fp, stripslashes($dane2)); 
  7. fclose($fp);
  8. ?>


Albo tak
  1. <?php
  2. echo fread($fp);
  3. $dane2 = ob_get_contents();
  4.  $file = "wp.txt"; 
  5.  $fp = fopen($file, "a+"); 
  6.  fwrite($fp, stripslashes($dane2)); 
  7. fclose($fp);
  8. ?>
Go to the top of the page
+Quote Post
-gog-
post 14.03.2008, 19:52:51
Post #5





Goście







ani jedno ani drugie nie dziala...
Go to the top of the page
+Quote Post
-gog-
post 14.03.2008, 19:56:13
Post #6





Goście







Any more ideas?
Go to the top of the page
+Quote Post
-Gość-
post 14.03.2008, 20:06:36
Post #7





Goście







dobra, dalem po prostu

Kod
ob_start();
echo fread($fp, 8000);
echo fread($fp, 8000);
echo fread($fp, 8000);
echo fread($fp, 8000);
echo fread($fp, 8000);
echo fread($fp, 8000);
echo fread($fp, 8000);
$dane2 = ob_get_contents();

i dziala, kiedys moze sie wezme za optymalizacje i poprawie, jak juz bede wiedzial jak to nalezy zrobic optymalnie
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 Wersja Lo-Fi Aktualny czas: 8.07.2025 - 21:14