SNAP Instructions Check HTTPS & cURL Connectivity

Check HTTPS & cURL Connectivity

Check outbound HTTPS connections and distinguish transport errors from API responses.

Start with WordPress Site Health

Open Tools → Site Health. Review reported HTTP, HTTPS, loopback, or background-task problems. In the Info tab, check the server’s PHP and cURL information.

PHP cURL diagnostic

If you have terminal access, save the following as snap-https-check.php outside your public web directory and run it with php snap-https-check.php. Ask your host to run it if you do not have terminal access.

<?php
if (!function_exists('curl_init')) {
    exit("PHP cURL is not installed. Contact your host.\n");
}
$urls = ['https://wordpress.org/', 'https://graph.facebook.com/'];
foreach ($urls as $url) {
    $ch = curl_init($url);
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_CONNECTTIMEOUT => 10,
        CURLOPT_TIMEOUT => 20,
        CURLOPT_SSL_VERIFYPEER => true,
        CURLOPT_SSL_VERIFYHOST => 2,
    ]);
    $result = curl_exec($ch);
    printf("%s | HTTP %d | cURL %d: %s\n", $url,
        curl_getinfo($ch, CURLINFO_HTTP_CODE),
        curl_errno($ch), curl_error($ch));
    if ($result === false) {
        echo "Connection failed.\n";
    }
    curl_close($ch);
}

Read the result

  • A nonzero cURL error indicates a transport problem, such as DNS resolution, a timeout, or certificate validation.
  • An HTTP response shows that the remote server answered. A 400, 401, 403, or other API error is not automatically a TLS failure; an API may require authorization even when connectivity is working.
  • A successful connection does not prove that the social account has publishing permissions. Check the actual SNAP delivery response as well.

What to send your host

Send the failing URL, cURL error number and message, and the time of the test. Ask your host to check outbound HTTPS access, DNS, certificate authorities, and firewall rules.

Keep certificate verification enabled. Fix certificate or server configuration errors rather than bypassing verification.

Reference: PHP cURL execution and error handling.

Scroll to Top