WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World
Add a normal cURL handle to a cURL multi handle

curl_multi_add_handle

(PHP 5)

curl_multi_add_handleAdd a normal cURL handle to a cURL multi handle

Description

int curl_multi_add_handle ( resource $mh , resource $ch )

Adds the ch handle to the multi handle mh

Parameters

mh

A cURL multi handle returned by curl_multi_init().

ch

A cURL handle returned by curl_init().

Return Values

Returns 0 on success, or one of the CURLM_XXX errors code.

Examples

Example #1 curl_multi_add_handle() example

This example will create two cURL handles, add them to a multi handle, and then run them in parallel.

<?php
// create both cURL resources
$ch1 curl_init();
$ch2 curl_init();

// set URL and other appropriate options
curl_setopt($ch1CURLOPT_URL"http://www.example.com/");
curl_setopt($ch1CURLOPT_HEADER0);
curl_setopt($ch2CURLOPT_URL"http://www.php.net/");
curl_setopt($ch2CURLOPT_HEADER0);

//create the multiple cURL handle
$mh curl_multi_init();

//add the two handles
curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);

$running=null;
//execute the handles
do {
    
curl_multi_exec($mh,$running);
} while(
$running 0);

//close all the handles
curl_multi_remove_handle($mh$ch1);
curl_multi_remove_handle($mh$ch2);
curl_multi_close($mh);
?>

See Also


Campaign Mailer - Allows sending emails to a mailing list with multiple classes of emails handled. Suitable for mailing campaigns.
Categories : PHP, PHP Classes, Email
Setup IIS using only 1 ip address and 1 ssl key but have multiple websites
Categories : WinNT, IIS, Web Servers
Add a scrolling status bar text to your site. You can have multiple lines of text. The text can appear in the given order or in random. A very good script to make announcements to your visitors.
Categories : Java Script, HTML



Handle multiple file upload
Categories : Complete Programs, Filesystem, PHP, HTML and PHP
Using Host Header Names to Host Multiple Sites from 1 IP Address [IIS4].
Categories : WinNT, IIS, Web Servers
phpSecurePages is a PHP module to secures pages with a loginname and password. It handles multiple user groups (each has own viewing rights), store data in a MySQL database or a configuration file, and can be used to identify Web site viewers.
Categories : PHP, Security, Authentication
Take multiple text files and do simple formatting on them and add them to a webpage
Categories : HTML, Filesystem, PHP
Simple Email address validation
Categories : Email, PHP, Strings
E-mail address check
Categories : PHP, Email, Regexps
Add Slashes Recursively
Categories : PHP, Arrays
Multilingual php webpage
Categories : PHP, Languages, Cookies
Which Storage Engine (table handler) to use with MySQL?
Categories : Databases, MySQL
phpCards - PHP/mySQL postcard script with web based admin to add, edit, and delete cards and categories. Very easy to install.
Categories : PHP, Complete Programs, HTML and PHP, MySQL
PHP MultiList Mailing List Manager
Categories : Email, HTML and PHP, PHP