1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 05:21:02 +02:00
Files
archived-php-src/ext/curl/tests/curl_basic_025.phpt
Ayesh Karunaratne d23e36da81 Add CURLINFO_EFFECTIVE_METHOD
Since Curl 7.72.0, it supports a new parameter
called `CURLINFO_EFFECTIVE_METHOD`, which returns the effect method
in HTTP(s) requests. This is similar to `CURLINFO_EFFECTIVE_URL`.

 - https://curl.se/libcurl/c/CURLINFO_EFFECTIVE_METHOD.html

This adds support for CURLINFO_EFFECTIVE_URL if ext/curl is built
with libcurl >= 7.72.0 (0x074800).

Closes GH-7595.
2021-10-21 10:33:40 +02:00

29 lines
629 B
PHP

--TEST--
Test curl_getinfo() function with CURLINFO_* from curl >= 7.72.0
--EXTENSIONS--
curl
--SKIPIF--
<?php $curl_version = curl_version();
if ($curl_version['version_number'] < 0x074800) {
exit("skip: test works only with curl >= 7.72.0");
}
?>
--FILE--
<?php
include 'server.inc';
$ch = curl_init();
$host = curl_cli_server_start();
$url = "{$host}/get.inc?test=";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "data");
curl_exec($ch);
var_dump(curl_getinfo($ch, CURLINFO_EFFECTIVE_METHOD));
curl_close($ch);
?>
--EXPECT--
string(4) "POST"