I'm having a problem with a script i'm running in my band's page.
The script gives a timeout on the following line
PHP:
while(!feof($fd)){
This is the rest of the script:
PHP:
<?php
$theLocation="http://eastbroadway.blogspot.com/";
$startingpoint = "<div id=\"main-content\">";
$endingpoint = "<a name=\"109785977847064434\">";
//don't mess with
preg_match("/^(https?:\/\/)?([^\/]*)(.*)/i", "$theLocation", $matches);
$theDomain = "http://" . $matches[2];
$page = $matches[3];
$fd = fopen($theDomain.$page, "r"); // maybe "rb" (not working)
$value = "";
while(!feof($fd)){
$value .= fread($fd, 4096);
}
fclose($fd);
$start= strpos($value, "$startingpoint");
$finish= strpos($value, "$endingpoint");
$length= $finish-$start;
$value=substr($value, $start, $length);
// end "don't touch this part"
This is disabled until you remove the // in front of this line.
$value = eregi_replace( "<IMG alt=[^>]*>", "", $value ); // Remove all image alt="whatever" tags
$value = eregi_replace( "<class[^>]*>", "", $value ); // Remove all variations of <class> tags.
$value = eregi_replace( "<table[^>]*>", "", $value ); // Remove ALL variations of <table> tags.
$value = eregi_replace( "<tr[^>]*>", "", $value ); // Replace <tr> tags with blank space.
$value = eregi_replace( "<td[^>]*>", "", $value ); // Remove all variations of <td> tags.
$value = str_replace( "</font>", "", $value ); // Remove closing </font> tags.
$value = str_replace( "</table>", "", $value ); // Remove closing </table> tags.
$value = str_replace( "</tr>", "", $value ); // Remove closing </tr> tags.
$value = str_replace( "</td>", "", $value ); // Remove closing </td> tags.
$value = str_replace( "<center>", "", $value ); // Remove <center> tag...
$value = str_replace( "</center>", "", $value ); // ...alignment calls.
$value = str_replace( "<b>", "", $value ); // Remove <b> tags.
$value = str_replace( "</b>", "", $value ); // Remove closing </b> tags...
//$value = eregi_replace( "<javascript[^>]*>", "", $value ); //remove javascripts
//$value = eregi_replace( "<script[^>]*>", "", $value ); //remove scripts
// replace normal links with HTML to open fetched links in new window
$value = eregi_replace( "href=", "target=\"_blank\" href=", $value );
// open links that use " in new window
$value = eregi_replace( "href=\"", "target=\"_blank\" href=\"", $value );
$FinalOutput = preg_replace("/(href=\"?)(\/[^\"\/]+)/", "\\1" . $theDomain . "\\2", $value);
echo $FinalOutput; //print to page
flush ();
?>
The goal of this script is to pull content off of one page and insert it into
another page. In this case, news updates.I'm hosting the files at http://members.lycos.co.uk/eastbroadway/
The total point of this message is...Is it just the server's timeout limit that is messing this up, or am i doing something wrong with the actual code?
Thanks for any help