xref: /PHP-8.3/ext/curl/tests/curl_basic_001.phpt (revision 8567bc10)
1--TEST--
2Test curl_exec() function with basic functionality
3--CREDITS--
4Sebastian Deutsch <sebastian.deutsch@9elements.com>
5TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
6--EXTENSIONS--
7curl
8--FILE--
9<?php
10  include 'server.inc';
11  $host = curl_cli_server_start();
12
13  // start testing
14  echo "*** Testing curl_exec() : basic functionality ***\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_URL, $url); //set the url we want to use
21  $ok = curl_exec($ch);
22  curl_close($ch);
23  $curl_content = ob_get_contents();
24  ob_end_clean();
25
26  if($ok) {
27    var_dump( $curl_content );
28  } else {
29    echo "curl_exec returned false";
30  }
31?>
32--EXPECT--
33*** Testing curl_exec() : basic functionality ***
34string(25) "Hello World!
35Hello World!"
36