Curl_error: couldn't connect to host. Using API v3 PHP Wrapper

Hi,

I'm trying to use the new V3 API to add a subscriber to one of my lists, I have the main API, and list API etc, and using your subscriber add test when running im getting this error:

Fatal error: Error making request with curl_error: couldn't connect to host in /srv/bathales.vm.bytemark.co.uk/public/htdocs/themes/bathales/includes/campaignmonitor/class/transport.php on line 132

cURL is installed, and OpenSSL isn't. However even trying to force your API to use HTTP by using this:

$wrap = new CS_REST_Subscribers('92aa94463366f16e74a3a718b67209fb', '207ff9948923cf26ad96b4f1e0a6fff7', 'http');

Still doesn't work.

The full subscriber code is:

require_once('includes/campaignmonitor/csrest_subscribers.php');

    $row->other_email = 'ben@kerve.co.uk';
    $row->billing_name_first = 'Ben';
    $row->billing_name_last = 'Smith';
   
   
    $wrap = new CS_REST_Subscribers('92aa94463366f16e74a3a718b67209fb', '207ff9948923cf26ad96b4f1e0a6fff7', 'http');
    $result = $wrap->add(array(
        'EmailAddress' => $row->other_email,
        'Name' => $row->billing_name_first.' '.$row->billing_name_last
    ));
   
    echo "Result of POST /api/v3/subscribers/{list id}.{format}\n<br />";
    if($result->was_successful()) {
        echo "Subscribed with code ".$result->http_status_code;
    } else {
        echo 'Failed with code '.$result->http_status_code."\n<br /><pre>";
        var_dump($result->response);
        echo '</pre>';
    }

Any ideas?



Ben

Carissa Carissa, 5 years ago

Hi Ben,

Thanks for posting here. I wanted to let you know we also received your email sent in to support. I've forwarded it to a developer who can get back to you. Thanks!


Carissa
Campaign Monitor

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098