xref: /PHP-7.0/ext/curl/tests/curl_basic_001.phpt (revision 41b655d9)
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--SKIPIF--
7<?php include 'skipif.inc'; ?>
8--FILE--
9<?php
10/* Prototype  : bool curl_exec(resource ch)
11 * Description: Perform a cURL session
12 * Source code: ext/curl/interface.c
13 * Alias to functions:
14 */
15  include 'server.inc';
16  $host = curl_cli_server_start();
17
18  // start testing
19  echo "*** Testing curl_exec() : basic functionality ***\n";
20
21  $url = "{$host}/get.php?test=get";
22  $ch = curl_init();
23
24  ob_start(); // start output buffering
25  curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
26  $ok = curl_exec($ch);
27  curl_close($ch);
28  $curl_content = ob_get_contents();
29  ob_end_clean();
30
31  if($ok) {
32    var_dump( $curl_content );
33  } else {
34    echo "curl_exec returned false";
35  }
36?>
37===DONE===
38--EXPECTF--
39*** Testing curl_exec() : basic functionality ***
40string(25) "Hello World!
41Hello World!"
42===DONE===
43