Welcome to WebmasterWorld Guest from 18.205.176.85

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

fread blank pages

     
10:59 pm on Dec 5, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 29, 2003
posts:94
votes: 0


can anyone point out what is wrong with this script please

x1 with PHP 4.3.7
x2 with PHP 4.3.9
all with: allow_url_fopen = on

<?php 

$GrabURL = "http://www.example.com/index.php";
$GrabStart = "<html>";
$GrabEnd = "</html>";

$OpenFile = fopen("$GrabURL", "r");
$RetrieveFile = fread($OpenFile, 200000);
$GrabData = eregi("$GrabStart(.*)$GrabEnd", $RetrieveFile, $DataPrint);
fclose($OpenFile);
echo $DataPrint[1];

?>


all i want to do is include a foreign page in my page. but only grab a certain part of the page .

problem is this code use to work for me a while back but now i get a blank page, tried different pages and 3 hosts i use. this seems to be since PHP was upgraded from 4.3.1 i believe.

as it seems to be the same on 3 different hosts i have not approached my host.

i have searched and googled and just seem to find other people with the same problem, i was hoping one of you experts could help.

Many Thanks

11:33 pm on Dec 5, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 26, 2004
posts:153
votes: 0


I would add some error checking to narrow it down.
Assuming this file opens fine. First I would check to see if $RetrieveFile has the file. Then, eregi returns TRUE or FALSE, I would put some error checking to see if it is not finding the pattern you want it to. Find out exatly where things a breaking down.

baze

9:16 am on Dec 6, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 29, 2003
posts:94
votes: 0


apparently this script relied on a security hole to work! which was patched after PHP 4.3.4 :o

does anyone know any other grabber scripts that work on 4.3.9 please