March 22nd, 2000, 01:05 AM
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?
March 22nd, 2000, 09:43 AM
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));
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().