1--TEST--
2Curl_multi_getcontent() basic test with different sources (local file/http)
3--CREDITS--
4Rein Velt (rein@velt.org)
5#TestFest Utrecht 20090509
6--SKIPIF--
7<?php include 'skipif.inc'; ?>
8--FILE--
9<?php
10	//CURL_MULTI_GETCONTENT TEST
11
12	//CREATE RESOURCES
13 	$ch1=curl_init();
14	$ch2=curl_init();
15
16	//SET URL AND OTHER OPTIONS
17    include 'server.inc';
18    $host = curl_cli_server_start();
19	curl_setopt($ch1, CURLOPT_URL, "{$host}/get.php?test=getpost&get_param=Hello%20World");
20	curl_setopt($ch2, CURLOPT_URL, "file://".dirname(__FILE__). DIRECTORY_SEPARATOR . "curl_testdata2.txt");
21	curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
22	curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
23
24	//CREATE MULTIPLE CURL HANDLE
25	$mh=curl_multi_init();
26
27	//ADD THE 2 HANDLES
28	curl_multi_add_handle($mh,$ch1);
29	curl_multi_add_handle($mh,$ch2);
30
31	//EXECUTE
32	$running=0;
33	do {
34		curl_multi_exec($mh,$running);
35	} while ($running>0);
36
37	$results1=curl_multi_getcontent($ch1);
38        $results2=curl_multi_getcontent($ch2);
39
40	//CLOSE
41 	curl_multi_remove_handle($mh,$ch1);
42	curl_multi_remove_handle($mh,$ch2);
43	curl_multi_close($mh);
44
45	echo $results1;
46	echo $results2;
47
48?>
49--EXPECT--
50array(2) {
51  ["test"]=>
52  string(7) "getpost"
53  ["get_param"]=>
54  string(11) "Hello World"
55}
56array(0) {
57}
58CURL2
59