cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

downloading parallel pages (multi threads)

From: imran khalid <imranlink_at_hotmail.com>
Date: Tue, 23 Nov 2004 07:48:02 +0000

Hi,

I want to download parallel pages from two web sites. i have seen some
functions for multi thread interface but have not get any example in PHP.
Can u please let me know how can i use these functions to download two web
pages Simultaneously from two different urls.

<?php

$multi_handle = curl_multi_init();

// What to write next to get the below code working in curl_multi_*
functions?
?>

<?php

// Old style. This will get one by one pages and takes time.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'www.google.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$str_page_1 = curl_exec ($ch);
curl_close ($ch);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'www.yahoo.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$str_page_2 = curl_exec ($ch);
curl_close ($ch);

?>

Sincerely,

Imran Khalid (Web Developer)
Email: imranlink_at_hotmail.com
..................................................

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
Received on 2004-11-23