1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 1999
    Rep Power
    I want to retrieve the content of a web page similar to wget for UNIX or HTTP::Request for perl. Does anyone know how to do this?
  2. #2
  3. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Central Florida, USA
    Rep Power
    1. Have you tried:


    This should just include the contents of a file into your PHP script. This can cause problems if the file you're including has elements that PHP tries to parse--which you don't want parsed.

    2. This script will pass any external file to the browser through your script.

    $filename = "http://www.yoururl.com/";
    $fd = fopen("http://www.yoururl.com/", "r");

    3. This script opens a file, turns the contents into a variable, with which you can do whatever you want, but it only works with local server files.

    $filename = "/usr/home/yourdirectory/public_html/htmlfile.html";
    $fd = fopen($filename,"r");
    $contents = fread($fd,filesize($filename));
    echo $contents;

    Also, you could use fopen() for a remote URL, and then fwrite() to save the file locally, and then do what you want with it with fread().

Similar Threads

  1. Run .bat file from web page
    By gadgetboy_karl in forum PHP Development
    Replies: 4
    Last Post: May 31st, 2005, 03:04 AM
  2. how to auto adjust resolution of web page??
    By tulip in forum ASP Programming
    Replies: 2
    Last Post: February 5th, 2004, 09:17 AM
  3. 2 web page probs - IE printing & trouble scrolling
    By cduffey346 in forum HTML Programming
    Replies: 0
    Last Post: February 4th, 2004, 04:55 PM
  4. input on web page using vb application
    By shaker22a in forum Visual Basic Programming
    Replies: 3
    Last Post: February 2nd, 2004, 07:39 PM
  5. can you use a field on a web page as a sql parameter?
    By doctorbev in forum ASP Programming
    Replies: 4
    Last Post: February 1st, 2004, 03:35 PM

IMN logo majestic logo threadwatch logo seochat tools logo