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

1.1       misho       1: --TEST--
                      2: Test curl_copy_handle() with simple 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:   $host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
                     11: 
                     12:   echo '*** Testing curl copy handle with simple POST ***' . "\n";
                     13: 
                     14:   $url = "{$host}/get.php?test=getpost";
                     15:   $ch = curl_init();
                     16: 
                     17:   ob_start(); // start output buffering
                     18:   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                     19:   curl_setopt($ch, CURLOPT_POST, 1);
                     20:   curl_setopt($ch, CURLOPT_POSTFIELDS, "Hello=World&Foo=Bar&Person=John%20Doe");
                     21:   curl_setopt($ch, CURLOPT_URL, $url); //set the url we want to use
                     22:   
                     23:   $copy = curl_copy_handle($ch);
                     24:   curl_close($ch);
                     25:  
                     26:   $curl_content = curl_exec($copy);
                     27:   curl_close($copy);
                     28: 
                     29:   var_dump( $curl_content );
                     30: ?>
                     31: ===DONE===
                     32: --EXPECTF--
                     33: *** Testing curl copy handle with simple POST ***
                     34: string(163) "array(1) {
                     35:   ["test"]=>
                     36:   string(7) "getpost"
                     37: }
                     38: array(3) {
                     39:   ["Hello"]=>
                     40:   string(5) "World"
                     41:   ["Foo"]=>
                     42:   string(3) "Bar"
                     43:   ["Person"]=>
                     44:   string(8) "John Doe"
                     45: }
                     46: "
                     47: ===DONE=== 

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