SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Evangelist -T-'s Avatar
    Join Date
    Jun 2002
    Posts
    444
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problems with loading a file

    does someone have a good idea why the fopen() and fread() functions doesn't read the whole source? Just test it and you will see that it only reads parts of the source. About 2200 chars is what it read on my server.

    PHP Code:
         $url ="http://www.sitepointforums.com";
         
    $remote fopen($url'r');
         
    $html fread($remote1024*1024);
         
    fclose($remote);
         
         echo 
    strlen($html).'<br />';
         echo 
    '<textarea cols="100" rows="20">'.$html.'</textarea>'
    chrome is a wrapper that combines a browser with spyware

  2. #2
    SitePoint Evangelist -T-'s Avatar
    Join Date
    Jun 2002
    Posts
    444
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm, I solved it by using file_get_contents($url) instead
    chrome is a wrapper that combines a browser with spyware

  3. #3
    <? james('rules'); ?>
    Join Date
    Jun 2004
    Location
    Wales, UK
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why did you post before trying to solve the problem yourself .

  4. #4
    SitePoint Evangelist -T-'s Avatar
    Join Date
    Jun 2002
    Posts
    444
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I worked on it for about 2 hours before I posted here
    chrome is a wrapper that combines a browser with spyware

  5. #5
    <? james('rules'); ?>
    Join Date
    Jun 2004
    Location
    Wales, UK
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hehe ok. Well well done for solving the problem anyway.

  6. #6
    If it aint Dutch it aint much Kilroy's Avatar
    Join Date
    Oct 2003
    Location
    The Netherlands
    Posts
    406
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    file_get_contents() is always the better choice over opening, reading in etc.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •