ID:               24033
 Comment by:       jemshad at deru dot net
 Reported By:      thomas at nimstad dot com
 Status:           Bogus
 Bug Type:         Sockets related
 Operating System: Win32
 PHP Version:      4.3.2
 New Comment:

That alternative works well with phpbbfm ( I too had the same problem -
thanks for suggestion ).

But, for a simple code, that modification is still not working. I get
only partial page when using fopen.

<?
$url="http://www.domain/test.txt";;
$file=file_get_contents($url,"r");
$read=fread($file,1000000);
echo $read;
fclose($file);
?>

This results in error.


Previous Comments:
------------------------------------------------------------------------

[2003-07-20 04:19:57] lzerace at msn dot com

Disregard I guess. I finally changed the following and seemed to have
it working now:

    $OpenFile = file_get_contents($AquireURL, "r"); //- Read The File
    //$RetrieveFile = fread($OpenFile, 200000);  //- Might Be Able To
Reduce This To Save Memory
    $AquireData = eregi("$AquireStart(.*)$AquireEnd", $OpenFile,
$DataPrint); // Acquire The Data

------------------------------------------------------------------------

[2003-07-20 04:03:29] lzerace at msn dot com

I have a feeling this discussion has to do with my script not working
(after host upgraded to 4.3.2 recently).

Can someone tell me what to modify or replace in the below to let the
fread portion to work properly?

<?php

function weather($Default_Weather_ZipCode)
{
    if ($userdata['user_zipcode'] =='')
    {
        $User_ZipCode = $Default_Weather_ZipCode;
    }
    else
    {
        $User_ZipCode = $userdata['user_zipcode'];
    }
$AquireURL =
'http://weather.cnn.com/weather/forecast.jsp?locCode='.$User_ZipCode;
//- Use if using codes
$AquireStart = '<!-- start forecast by LOC code \(smb\) -->'; //- HTML
Code To Start Aquire. Must Be A Unique Bit Of Code! 
$AquireEnd = '<!-- end forecast by LOC code \(smb\) -->'; //- HTML Code
To End Aquire. Must Be A Unique Bit Of Code! 
    $OpenFile = fopen($AquireURL, "r"); //- Read The File
    $RetrieveFile = fread($OpenFile, 200000);  //- Might Be Able To
Reduce This To Save Memory
    $AquireData = eregi("$AquireStart(.*)$AquireEnd", $RetrieveFile,
$DataPrint); // Acquire The Data
    //
    $gotWeather = str_replace('face=Arial', 'face="Verdana, Arial"
color="black"', $DataPrint[1]); // Change Font
    //
if ($AquireData == "")
{
$gotWeather = '<a href="' . append_sid("profile.php?mode=editprofile")
. '"><img src="' . append_sid("wtr.gif") . '"></a>';
//$gotWeather = '<b>OFFLINE</b>';
}
  return $gotWeather;
}

?>

------------------------------------------------------------------------

[2003-07-18 01:35:12] webmaster at webtechies dot net

I can say that some of you guys here are really life savers.

I was working on my scripts for hours and I could see that there is
something wrong with the length of the pockets it reads but couldn't
find anything in the manual. And my codes were working until my ISP
re-build the server.

Then I found the answer here.

Thanks guys. Hopefully the fix will stay working in next version too.

------------------------------------------------------------------------

[2003-06-13 18:20:58] [EMAIL PROTECTED]

bob at bravenet dot com:
That is just one of the reasons why we reinstated the pre 4.3.x
behaviour.
Please check your history before complaining.


------------------------------------------------------------------------

[2003-06-13 17:29:07] bob at bravenet dot com

I absolutely disagree with the conclusion on this bug. To outright
change the functionality of fread like this without any notice
whatsoever and especially in a minor revision is totally irresponsible
as a company.

To date fread has always taken a $length parameter and php handled the
buffering. And the docs still say that it will. When making a change
like this, at a minimum, update the docs so we don't waste a couple
days trying to find out that you changed the functionality of fread.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/24033

-- 
Edit this bug report at http://bugs.php.net/?id=24033&edit=1

Reply via email to