1--TEST--
2curl_setopt() call with CURLOPT_RETURNTRANSFER
3--CREDITS--
4Paul Sohier
5#phptestfest utrecht
6--EXTENSIONS--
7curl
8--FILE--
9<?php
10
11include 'server.inc';
12$host = curl_cli_server_start();
13
14// start testing
15echo "*** curl_setopt() call with CURLOPT_RETURNTRANSFER set to 1\n";
16
17$url = "{$host}/";
18$ch = curl_init();
19
20curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
21curl_setopt($ch, CURLOPT_URL, $url);
22
23$curl_content = curl_exec($ch);
24curl_close($ch);
25
26var_dump( $curl_content );
27
28echo "*** curl_setopt() call with CURLOPT_RETURNTRANSFER set to 0\n";
29
30$ch = curl_init();
31
32curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
33curl_setopt($ch, CURLOPT_URL, $url);
34ob_start();
35$curl_content = curl_exec($ch);
36ob_end_clean();
37curl_close($ch);
38
39var_dump( $curl_content );
40?>
41--EXPECTF--
42*** curl_setopt() call with CURLOPT_RETURNTRANSFER set to 1
43string(%d) "%a"
44*** curl_setopt() call with CURLOPT_RETURNTRANSFER set to 0
45bool(true)
46