> curl_setopt($ch, CURLOPT_URL, "http://foo.bar.com/page1.html");
> curl_setopt($ch, CURLOPT_FILE, $fh1);
> curl_exec($ch); //exec1
> curl_setopt($ch, CURLOPT_URL, "http://foo.bar.com/page2.html");
> curl_setopt($ch, CURLOPT_FILE, $fh2);
> curl_exec($ch); //exec2
> curl_setopt($ch, CURLOPT_URL, "http://foo.bar.com/page3.html");
> curl_setopt($ch, CURLOPT_FILE, $fh3);
every time you set CURLOPT_URL and CURLOPT_FILE you overwrite the last
value. that's why only the last page will be fetched ...
write a function that fetches ONE page and call that in a loop for every
page you want to fetch.
something like this
function fetchAndSavePage($url)
{
// put your fopen & curl code here
// convert the $url into a useful filename
$pagesToFetch = array ("page1","page2","page3");
foreach ($pagesToFetch as $url)
{
fetchAndSavePage($url);
}
good luck,
phil
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php