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

1.1       misho       1: --TEST--
                      2: Test curl_copy_handle() after exec() with POST
                      3: --CREDITS--
                      4: Rick Buitenman <rick@meritos.nl>
                      5: #testfest Utrecht 2009
                      6: --SKIPIF--
                      7: <?php if (!extension_loaded("curl") || false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) print "skip need PHP_CURL_HTTP_REMOTE_SERVER environment variable"; ?>
                      8: --FILE--
                      9: <?php
                     10: 
                     11:   $host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
                     12: 
                     13:   echo '*** Test curl_copy_handle() after exec() with POST ***' . "\n";
                     14: 
                     15:   $url = "{$host}/get.php?test=getpost";
                     16:   $ch = curl_init();
                     17: 
                     18:   ob_start(); // start output buffering
                     19:   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                     20:   curl_setopt($ch, CURLOPT_POST, 1);
                     21:   curl_setopt($ch, CURLOPT_POSTFIELDS, "Hello=World&Foo=Bar&Person=John%20Doe");
                     22:   curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
                     23:   
                     24:   
                     25:   $curl_content = curl_exec($ch);
                     26:   $copy = curl_copy_handle($ch);
                     27:   curl_close($ch);
                     28:   
                     29:   $curl_content_copy = curl_exec($copy);
                     30:   curl_close($copy);
                     31: 
                     32:   var_dump( $curl_content_copy );
                     33: ?>
                     34: ===DONE===
                     35: --EXPECTF--
                     36: *** Test curl_copy_handle() after exec() with POST ***
                     37: string(163) "array(1) {
                     38:   ["test"]=>
                     39:   string(7) "getpost"
                     40: }
                     41: array(3) {
                     42:   ["Hello"]=>
                     43:   string(5) "World"
                     44:   ["Foo"]=>
                     45:   string(3) "Bar"
                     46:   ["Person"]=>
                     47:   string(8) "John Doe"
                     48: }
                     49: "
                     50: ===DONE=== 

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