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

1.1       misho       1: --TEST--
                      2: Test curl option CURLOPT_RETURNTRANSFER 
                      3: --CREDITS--
                      4: Mathieu Kooiman <mathieuk@gmail.com>
                      5: Dutch UG, TestFest 2009, Utrecht
                      6: --DESCRIPTION--
                      7: Writes the value 'test' to a temporary file. Use curl to access this file and have it return the content from curl_exec(). Tests the PHP_CURL_RETURN case
                      8: of curl_write().
                      9: --SKIPIF--
                     10: <?php if (!extension_loaded("curl")) print "skip"; ?>
                     11: --FILE--
                     12: <?php
                     13: 
                     14: $log_file = tempnam(sys_get_temp_dir(), 'php-curl-test');
                     15: 
                     16: $fp = fopen($log_file, 'w+');
                     17: fwrite($fp, "test");
                     18: fclose($fp);
                     19: 
                     20: $ch = curl_init();
                     21: curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                     22: curl_setopt($ch, CURLOPT_URL, 'file://' . $log_file);
                     23: $result = curl_exec($ch);
                     24: curl_close($ch);
                     25: 
                     26: echo $result;
                     27: 
                     28: // cleanup
                     29: unlink($log_file);
                     30: 
                     31: ?>
                     32: --EXPECT--
                     33: test

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