[ Q_Line @ 03.04.2004. 10:04 ] @
Pozdrav!

Imam djelom problema sa ovim php grabberom... sistem djelom radi kako treba no kad mu se zada kao pocetna opcija tag tabele kaze da ne moze naci izvor...

Evo koda scripta:

Code:
  // Global Variables 
$filename = "http://www.wtowatch.org/whatsNew/";      // Location of the News Source 
$start = "<b>Daily News";            // Start Grabbing Code 
$stop  = "</table>";                 // Stop Grabbing Code 
$page  = "wtowatch.txt";            //cache file name
  

  // Get contents of the specified URL and writes it into a string 
$fd = fopen( $filename, "r" ); 
$contents = fread( $fd, 20000 ); 
fclose( $fd ); 

  // Isolates desired section. 
if(eregi("$start(.*)$stop", $contents, $printing)) { 
  $substring=$printing[1]; 
  

  // while is added as there are multiple instances of the </table> string & eregi 
  // searches to include the most that matches, not the next. 
 while(eregi("(.*)$stop", $substring, $printing)) { 
     $substring=$printing[1]; 
   }; 

 } else { 
   echo "Didn't find Daily summary"; 
 } 

  // Replaces specific HTML tags and text 
$printing[1] = eregi_replace( "- .* records</b>", "", $printing[1] ); // Text 
$printing[1] = eregi_replace( "<IMG SRC=[^>]*>", "", $printing[1] );   // Images 
$printing[1] = eregi_replace( "<font[^>]*>", "", $printing[1] ); // Fonts 
$printing[1] = eregi_replace( "</font>", "", $printing[1] ); 
$printing[1] = eregi_replace( "<tr[^>]*>", "<li>", $printing[1] ); // Table Codes 
$printing[1] = eregi_replace( "<td[^>]*>", "", $printing[1] ); 
$printing[1] = eregi_replace( "</tr>", "", $printing[1] ); 
$printing[1] = eregi_replace( "</td>", "", $printing[1] ); 

  // Adds Absolute URL 
$printing[1] = eregi_replace( "href=\"", "href=\"http://www.wtowatch.org", $printing[1]); 

  //  Saves output to include file 
$cartFile = fopen("$page","w"); 
fwrite($cartFile,$printing[1]); 
fclose($cartFile); 


E kad u:

$start = "<b>Daily News"; // Start Grabbing Code

postavim npr:

$start = "<table align=\"center\" width=\"300\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; // Start Grabbing Code

scripta kaze da ne moze naci source.
Vjerovatno zbog:
while(eregi("(.*)$stop", $substring, $printing))
opcije i visestrukog ponavljanja <table kao taga u html kodu!

Da li se ovo moze nekako srediti!?

Tnx!
[ -zombie- @ 04.07.2004. 17:24 ] @
šta tačno želiš da grebeš?