xref: /PHP-7.2/ext/curl/tests/curl_basic_002.phpt (revision 17ccbeec)
1--TEST--
2Test curl_opt() function with CURLOPT_RETURNTRANSFER parameter set to 1
3--CREDITS--
4Sebastian Deutsch <sebastian.deutsch@9elements.com>
5TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
6--SKIPIF--
7<?php include 'skipif.inc'; ?>
8--FILE--
9<?php
10/* Prototype  : bool curl_setopt(resource ch, int option, mixed value)
11 * Description: Set an option for a cURL transfer
12 * Source code: ext/curl/interface.c
13 * Alias to functions:
14 */
15
16  include 'server.inc';
17  $host = curl_cli_server_start();
18
19  // start testing
20  echo '*** Testing curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); ***' . "\n";
21
22  $url = "{$host}/get.php?test=get";
23  $ch = curl_init();
24
25  ob_start(); // start output buffering
26  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
27  curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
28
29  $curl_content = curl_exec($ch);
30  curl_close($ch);
31
32  var_dump( $curl_content );
33?>
34===DONE===
35--EXPECTF--
36*** Testing curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); ***
37string(25) "Hello World!
38Hello World!"
39===DONE===
40