In my opinion, and clearly the opinion of the people who contributed to the packaging of Ubuntu 20.04, it is much clearer to use the newer interfaces. "Content-type: application/x-www-form-urlencoded\r\n", you can use the following, adapted from contributions to the documentation page for stream_context_create: $opts = array( There is not even a reference to stream_context_create which can be used with fopen, readfile, or SplFileObject. In particular there is nothing in the PHP documentation for curl_init to suggest that it is not a standard feature of PHP, and the recommended way to exchange information over the Internet. These older interfaces are used by many existing applications and therefore should either be in the supported repositories, or a clear pointer must be provided to alternatives that are supported which require rewriting the code to modern standards. There are a number of issues posted here on AskUbuntu about older features of PHP such as CURL, and the procedure oriented functions for SQL database access, which do not work on Ubuntu 20.04 and PHP 7.4 out of the box.
HOW TO INSTALL CURL PHP5 UPDATE
It would appear that evangelists for more modern features have chosen to deprecate older feature implementations, even though there is nothing in the PHP documentation to hint that these features are deprecated. sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php7.4-curl.