xref: /PHP-8.0/ext/curl/tests/curl_basic_002.phpt (revision b5c7a83d)
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  include 'server.inc';
11  $host = curl_cli_server_start();
12
13  // start testing
14  echo '*** Testing curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); ***' . "\n";
15
16  $url = "{$host}/get.inc?test=get";
17  $ch = curl_init();
18
19  ob_start(); // start output buffering
20  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
21  curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
22
23  $curl_content = curl_exec($ch);
24  curl_close($ch);
25
26  var_dump( $curl_content );
27?>
28--EXPECT--
29*** Testing curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); ***
30string(25) "Hello World!
31Hello World!"
32