Annotation of embedaddon/php/ext/curl/tests/curl_copy_handle_basic_007.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test curl_copy_handle() with simple POST
                      3: --SKIPIF--
                      4: <?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
                      5: --FILE--
                      6: <?php
                      7:   $host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
                      8: 
                      9:   echo '*** Testing curl copy handle with simple POST using array as arguments ***' . "\n";
                     10: 
                     11:   $url = "{$host}/get.php?test=getpost";
                     12:   $ch = curl_init();
                     13: 
                     14:   ob_start(); // start output buffering
                     15:   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                     16:   curl_setopt($ch, CURLOPT_POST, 1);
                     17:   curl_setopt($ch, CURLOPT_POSTFIELDS, array("Hello" => "World", "Foo" => "Bar", "Person" => "John Doe"));
                     18:   curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); // Disable Expect: header (lighttpd does not support it :)
                     19:   curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
                     20:   
                     21:   $copy = curl_copy_handle($ch);
                     22:   curl_close($ch);
                     23:  
                     24:   $curl_content = curl_exec($copy);
                     25:   curl_close($copy);
                     26: 
                     27:   var_dump( $curl_content );
                     28: ?>
                     29: ===DONE===
                     30: --EXPECTF--
                     31: *** Testing curl copy handle with simple POST using array as arguments ***
                     32: string(163) "array(1) {
                     33:   ["test"]=>
                     34:   string(7) "getpost"
                     35: }
                     36: array(3) {
                     37:   ["Hello"]=>
                     38:   string(5) "World"
                     39:   ["Foo"]=>
                     40:   string(3) "Bar"
                     41:   ["Person"]=>
                     42:   string(8) "John Doe"
                     43: }
                     44: "
                     45: ===DONE=== 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>