Decoding cURL Error 35 on Ubuntu: A TLS Protocol Mismatch
You are facing a classic environment-specific SSL handshake failure. The error cURL error 35 - Unknown SSL protocol error indicates that the client (your PHP script) and the server (api.rkd.reuters.com) could not agree on a common cryptographic protocol version or cipher suite during the initial TLS handshake.
The critical clue here is not just the error itself, but the discrepancy between your environments. The connection works perfectly on macOS but fails on Ubuntu and AWS instances. This environment divergence almost always points to a difference in the underlying SSL/TLS libraries rather than an issue with the target server or network reachability. The output shows SSLv3, TLS handshake, which suggests the client is attempting to initiate a session, but the specific implementation details of how OpenSSL handles this on Linux differ from the native implementation on macOS.
Root Cause: OpenSSL Implementation Differences
The primary suspect is the version and configuration of the OpenSSL library installed on your Ubuntu system versus the one bundled with macOS. Older versions of OpenSSL (common in default Ubuntu repositories) may have different security defaults or lack support for newer cipher suites that the Reuters API requires. Conversely, macOS uses a proprietary Secure Transport framework that handles TLS differently from standard OpenSSL.
The verbose output confirms the connection to the IP (159.220.40.240) succeeds, ruling out basic firewall blocks or DNS issues. The failure happens strictly at the cryptographic negotiation phase. If your Ubuntu machine is running an older version of libssl that does not support the protocol versions (like TLS 1.2 or TLS 1.3) mandated by the server, the handshake will abort immediately with this generic "Unknown SSL protocol error."
Diagnosing the OpenSSL Version and Configuration
Before attempting to upgrade packages, you must verify exactly what your Ubuntu system is negotiating. The default php-curl extension often links against the system-wide OpenSSL library. Run the following command in your shell to inspect the current configuration:
curl -v https://api.rkd.reuters.com/api/2006/05/01/TokenManagement_1.svc/Anonymous 2>&1 | grep -i "ssl"
Look closely at the SSL connection using TLS line. If it says TLSv1.2, you are likely good on protocol version, but the cipher suite might be rejected. If it attempts SSLv3 or TLSv1.0, that is a major red flag, as modern servers often disable these legacy protocols for security.
You can also check the specific OpenSSL version and its supported protocols:
openssl version -a | grep "OpenSSL"
openssl ciphers -v 'TLS_AES_256_GCM_SHA384'
If your system lacks modern cipher suites, the server will reject the connection.
Resolving the Issue via Library Upgrades
The most robust solution on Ubuntu is to ensure you are using a modern, patched version of OpenSSL that supports current security standards. If your project is hosted on AWS, verify that libssl and libcurl are updated to versions 1.1.1 or higher (preferably 1.1.1k+).
If you cannot upgrade the system libraries immediately, you can force PHP to use a newer version of OpenSSL bundled with the PECL curl extension. This is often achieved by installing php-curl via PPA or compiling it from source against a newer libssl.
In your PHP configuration (php.ini), ensure that you are not explicitly forcing legacy protocols:
openssl.cafile = /etc/ssl/certs/ca-certificates.crt
openssl.verify_peer = On
curl.protocols = tls, tls12, tls13
Setting curl.protocols to exclude SSLv3 and TLSv1.0 forces the client to negotiate only with modern protocols. If the server requires TLS 1.2 or higher and your Ubuntu instance defaults to negotiating older versions due to library limitations, this directive resolves the protocol mismatch.
When System Upgrades Are Not an Option
If you are running a legacy OS where upgrading system libraries is impossible, consider using a containerized environment (Docker) with a base image that has modern OpenSSL pre-installed. This isolates the SSL library from the host system's potentially outdated packages.
Alternatively, if the issue persists despite correct protocols and ciphers, inspect the CAfile path shown in your verbose output: CAfile: none. While your system points to /etc/ssl/certs, some strict servers require a specific CA bundle format. You can explicitly define the certificate authority file in your PHP script or CLI command:
curl --cacert /etc/ssl/certs/ca-certificates.crt https://api.rkd.reuters.com/...
If you are building a Laravel application, ensure that the composer require dependencies do not pull in an older version of php-http/discovery or related SSL handling packages that might override your system's libcurl settings. Sometimes, using http-interop libraries can introduce their own SSL context handling that conflicts with the native OpenSSL implementation.
Finally, if you are hosting this on AWS, ensure your Security Groups allow outbound traffic on port 443 to the specific IP range of the Reuters API, though given the error occurs at the SSL layer, network ACLs are less likely the culprit than the library version mismatch observed between macOS and Ubuntu.