/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/curl/tests/curl_write_callback.phpt
35 строк
777 B
Daniel Scherzer
[RFC] Deprecate curl_close() (#19451)
12 авг 2025, 15:44
Не верифицирован
12 авг 2025, 15:44
9b13bb1
Код
Авторство
О чём код?
--TEST-- Test curl option CURLOPT_WRITEFUNCTION --CREDITS-- Mathieu Kooiman <mathieuk@gmail.com> Dutch UG, TestFest 2009, Utrecht --DESCRIPTION-- Writes the value 'test' to a temporary file. Use curl to access this file, passing the output into a callback. Tests the PHP_CURL_USER case in curl_write. --EXTENSIONS-- curl --FILE-- <?php function curl_callback($curl_handle, $received_data) { echo $received_data; return strlen($received_data); } $log_file = tempnam(sys_get_temp_dir(), 'php-curl-test'); $fp = fopen($log_file, 'w+'); fwrite($fp, "test"); fclose($fp); $ch = curl_init(); curl_setopt($ch, CURLOPT_WRITEFUNCTION, 'curl_callback'); curl_setopt($ch, CURLOPT_URL, 'file://' . $log_file); curl_exec($ch); // cleanup unlink($log_file); ?> --EXPECT-- test