forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcurl_basic_001.phpt
42 lines (38 loc) · 1 KB
/
curl_basic_001.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--TEST--
Test curl_exec() function with basic functionality
--CREDITS--
Sebastian Deutsch <[email protected]>
TestFest 2009 - AFUP - Jean-Marc Fontaine <[email protected]>
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
/* Prototype : bool curl_exec(resource ch)
* Description: Perform a cURL session
* Source code: ext/curl/interface.c
* Alias to functions:
*/
include 'server.inc';
$host = curl_cli_server_start();
// start testing
echo "*** Testing curl_exec() : basic functionality ***\n";
$url = "{$host}/get.php?test=get";
$ch = curl_init();
ob_start(); // start output buffering
curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
$ok = curl_exec($ch);
curl_close($ch);
$curl_content = ob_get_contents();
ob_end_clean();
if($ok) {
var_dump( $curl_content );
} else {
echo "curl_exec returned false";
}
?>
===DONE===
--EXPECTF--
*** Testing curl_exec() : basic functionality ***
string(25) "Hello World!
Hello World!"
===DONE===