Mutual Authentiction on HTTPS with WordPress HTTP API?

Re the WP HTTP API look for the sslverify and sslcertificates args in this docs page: https://developer.wordpress.org/reference/classes/wp_http/request/. sslverify defaults to true and sslcertificates accepts an absolute path to a certificate file.

If you’re going to be doing a lot of lifting with this API (sounds like it for a real estate site), I would suggest considering the popular PHP library Guzzle: http://docs.guzzlephp.org/en/stable/

You will likely save yourself headaches over anything with fsock/curl. Many WP plugins use Guzzle under the hood. It’s well-documented, has tons of examples online, and supports the sort of functionality that you need. It can be installed via composer: composer require guzzle/guzzle

Seeing as your primary concern is authentication with a certificate, when you instantiate a new GuzzleHttp\Client, include the cert and ssl_key args:

See:

Leave a Comment