maborak.com~/blog/add-subscribers-using-interspire-apisoftware & infrastructure engineering
Back to all articles

Add subscribers using the Interspire XML API

Import or add subscribers to any Interspire Email Marketer contact list with the XML API exposed by the Installer addon.

By the Maborak engineering team · · 1 min read

With the Installer addon installed, Interspire Email Marketer exposes an XML API that can add or import subscribers into any contact list. Create an XML user in the Interspire users section first, then POST to xml.php with the subscriber_add process:

<?php
function sock($url = '', $post = [], $username = false, $password = false)
{
    $query_build = http_build_query($post);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $query_build);
    curl_setopt($ch, CURLOPT_HTTPHEADER, ['Expect:']);
    if ($username) {
        curl_setopt($ch, CURLOPT_USERPWD, "{$username}:{$password}");
        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    }
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}

// XML API credentials, generated in the Interspire users section.
$username = 'admin';
$password = 'YOUR_XML_API_TOKEN';
$url      = 'https://your-interspire-host/xml.php';
$listid   = 34;

$params = [
    'username' => $username,
    'password' => $password,
    'process'  => 'subscriber_add',
    'params'   => [
        'listid'       => $listid,
        'emailaddress' => '[email protected]',
    ],
];

var_dump(sock($url, $params));

Point $url at your own installation, set $listid to the target contact list, and take $password from the XML user you created — not the admin login password.

Back to all articles

Technologies we work with

  • Argo CD
  • Kubernetes
  • Docker
  • Podman
  • Ansible
  • Jenkins
  • Chef
  • Proxmox VE
  • Google Cloud
  • Linux
  • Red Hat
  • CentOS
  • NGINX
  • Apache
  • Traefik
  • Prometheus
  • Grafana
  • PostgreSQL
  • MySQL
  • MariaDB
  • Redis
  • etcd
  • Qdrant
  • Elasticsearch
  • Logstash
  • Kibana
  • PagerDuty
  • Go
  • Python
  • FastAPI
  • PHP
  • TypeScript
  • React