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