Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / curl / tests / curl_basic_001.phpt
blobfa362b33cec272be63550760688f9f833cd6483c
1 --TEST--
2 Test curl_exec() function with basic functionality 
3 --CREDITS--
4 Sebastian Deutsch <sebastian.deutsch@9elements.com>
5 TestFest 2009 - AFUP - Jean-Marc Fontaine <jmf@durcommefaire.net>
6 --SKIPIF--
7 <?php 
8 if (!extension_loaded("curl")) exit("skip curl extension not loaded");
9 if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER'))  exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
11 --FILE--
12 <?php
13 /* Prototype  : bool curl_exec(resource ch)
14  * Description: Perform a cURL session 
15  * Source code: ext/curl/interface.c
16  * Alias to functions: 
17  */
18         
19   $host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
21   // start testing
22   echo "*** Testing curl_exec() : basic functionality ***\n";
24   $url = "{$host}/get.php?test=get";
25   $ch = curl_init();
27   ob_start(); // start output buffering
28   curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
29   $ok = curl_exec($ch);
30   curl_close($ch);
31   $curl_content = ob_get_contents();
32   ob_end_clean();
34   if($ok) {
35     var_dump( $curl_content );
36   } else {
37     echo "curl_exec returned false";
38   }
40 ===DONE===
41 --EXPECTF--
42 *** Testing curl_exec() : basic functionality ***
43 string(25) "Hello World!
44 Hello World!"
45 ===DONE===