Hi
Perhaps cleaner, you could use PEAR package HTTP_Request.
Another advantage is you can make several page the same time if you want.
PHP Code:
require_once "HTTP/Request.php";
$urlList = array(
'http://www.example.com/', // to get the index.php
'http://www.example.com/document.php', // a document
'http://example2.com/foobar.php' // other site
);
$req =& new HTTP_Request();
foreach ($urlList as $url) {
$req->setURL($url);
if (!PEAR::isError($req->sendRequest())) {
$content= $req->getResponseBody();
// here you save the document
} else {
echo "ERROR: Cannot reach {$url} !\n";
}
}
If you need you can even post data, change the protocol ...
Don't you like it ?
Bye
Bookmarks