View Single Post
  #1 (permalink)  
Old Apr 5th, 2008, 19:58
CloudedVision's Avatar
CloudedVision CloudedVision is offline
Nerdy Moderator
Join Date: Feb 2008
Location: In My Own Little World
Age: 14
Posts: 942
Blog Entries: 8
Thanks: 2
Thanked 22 Times in 22 Posts
Send a message via AIM to CloudedVision Send a message via MSN to CloudedVision Send a message via Skype™ to CloudedVision
[SOLVED] fread only reading 78 characters

I'll give you a quick rundown:

  • Script downloads page from external server using CURL
  • CURL writes it to temp.xml
  • Use fopen to open temp.xml
  • Use fread to read temp.xml
Any reason why this is happening? I've checked temp.xml, and it has all the content in there. But fread only returns the first 78 characters. Why? It's worked fine in some other scripts. Here's a snippet of code:

PHP: Select all

function proxy($url) {
        
$ch curl_init($url); //CURL URL to temporary file
        
$fp = @fopen("temp.xml""w");
        
curl_setopt($chCURLOPT_FILE$fp); //I have no idea what this does
        
curl_setopt($chCURLOPT_HEADER0);
        
curl_exec($ch);
        
curl_close($ch);
        
fclose($fp);
        
$filename "temp.xml";
        
$fp fopen($filename"r"); //Read temporary file
        
$content fread($fpfilesize($filename));
        
fclose($fp);
        return 
$content;
    } 
__________________
echo "Take it easy, ".$CloudedVision;
.links { site: other-road-design; blog: only-nerds-allowed; project: resource-fish; organization: ARMIES6; }
<quote>&quot;I think it's wrong that only one company makes the game Monopoly&quot; - <name>Steven Wright</name></quote>
Reply With Quote