Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> problem z wyciagnieciem obrazka z serwisu
miszqa
post
Post #1





Grupa: Zarejestrowani
Postów: 168
Pomógł: 0
Dołączył: 15.01.2004
Skąd: Suwalki/Poznan

Ostrzeżenie: (10%)
X----


  1. <?php
  2.  
  3. $GrabURL = &#092;"http://pogoda.wp.pl/mi.html?POD=1&mid=1201261&date=\"; 
  4. $GrabStart = &#092;"<br><br><img src=\"\"; 
  5. $GrabEnd = &#092;"<br><br>temp\"; 
  6. ##### 
  7. $OpenFile = fopen(&#092;"$GrabURL\", \"r\"); 
  8. $RetrieveFile = fread($OpenFile, 200000); 
  9. $GrabData = eregi(&#092;"$GrabStart(.*)$GrabEnd\", $RetrieveFile, $DataPrint); 
  10. $DataPrint[1] = str_replace(&#092;"i/\", \"<img width=\"50\" height=\"50\" border=\"0\" src=\"http://pogoda.wp.pl/i/\", $DataPrint[1]); 
  11. fclose($OpenFile); 
  12. echo &#092;"<a href=\"http://pogoda.wp.pl/mi.html?mid=1201261\" border=\"200\" target=\"_blank\">\";
  13. echo &#092;" $DataPrint[1]\";
  14. echo &#092;"</a>\";
  15.  
  16. ?>

tak wyglada skrypt i ten skrypt nie chce mi pobrac obrazka a nie wiem co jest tego przyczyna? ktos ma pomysl. Bo jak bawilem sie na lokalu to dzialalo?questionmark.gif


--------------------
nie wszystko jeszcze wiem, uczę się, ale dzięki za wszelką pomoc i wyrozumiałość (Win2k, Apache, MySQL 3.23.39)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
crash
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 196
Pomógł: 2
Dołączył: 17.01.2004
Skąd: Sosnowiec

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


Sprawdz co ci pobiera ten fread, bo u mnie nawet calego naglowka strony WP nie pobral wiec nie znajdziesz tam tego obrazka.

A ja to zrobilem tak:
  1. <?php
  2. $url = 'http://pogoda.wp.pl/mi.html?POD=1&mid=1201261&date=';
  3.  
  4. $f = fopen($url, 'r'); 
  5.  
  6. while(!eregi(&#092;"tt<br><br><img src=\"i/(.*)\">\", $linia, $out) or !feof($f))
  7. {
  8.     $linia = fgets($f);
  9. }
  10. fclose($f);
  11.  
  12. echo '<a href=\"http://pogoda.wp.pl/mi.html?mid=1201261\" border=\"200\" target=\"_blank\"><img border=\"0\" src=\"http://pogoda.wp.pl/i/'.$out[1].'\"></a>';
  13. ?>


Ten post edytował crashu 28.12.2004, 11:20:27


--------------------
Go to the top of the page
+Quote Post
-Guest-
post
Post #3





Goście







bardzo mi przykro ale twoje rozwiazanie w ogole niczego nie wyswietla
Go to the top of the page
+Quote Post
crash
post
Post #4





Grupa: Przyjaciele php.pl
Postów: 2 196
Pomógł: 2
Dołączył: 17.01.2004
Skąd: Sosnowiec

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


No działało, ale przestało, tak to czasem bywa... Tu masz poprawkę:

  1. <?php
  2. $url = 'http://pogoda.wp.pl/mi.html?mid=1201261';
  3.  
  4. if($f = @fopen($url, 'r'))
  5. {
  6. while(!feof($f))
  7. {
  8.  $linia = fgets($f);
  9.  if(strpos($linia, '<br><br><img src=\"i/'))
  10.  {
  11.  preg_match('#<img src=\"i/([a-z0-9]+.gif)\">#', $linia, $img);
  12.  break;
  13.  }
  14. }
  15. fclose($f);
  16.  
  17. echo '<a href=\"http://pogoda.wp.pl/mi.html?mid=1201261\" border=\"200\" target=\"_blank\"><img border=\"0\" src=\"http://pogoda.wp.pl/i/'.$img[1].'\"></a>';
  18. }
  19. ?>


--------------------
Go to the top of the page
+Quote Post
-cashu-
post
Post #5





Goście







  1. <?php
  2. $url = 'http://pogoda.wp.pl/mi.html?mid=1201261';
  3.  
  4. if($f = @fopen($url, 'w'))
  5. {
  6. while(!isset(feof($f)))
  7. {
  8.  $linia = fgets($f);
  9.  if(strpos($linia, '<br><br><img src=\"t/'))
  10.  {
  11.  preg_match('#<img src=\"i/([:00-9]+.gif)\">#', $linia, $img);
  12.  break;
  13.  }
  14. }
  15. fclose($f);
  16.  
  17. echo '<a href=\"http://pogoda.wp.pl/mi.html?mid=1201261\" border=\"200\" target=\"_blank\"><img border=\"0\" src=\"http://pogoda.wp.pl/i/'.$img[1].'\"></a>';
  18. }
  19. ?>
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: 20.08.2025 - 09:08