Quite a few users have asked about methods to subscribe a user transparently from their website (ie. When they purchased a product from your website, and have opt-in to subscribe to your mailing list), and don't want to get the "Thank you" page displayed after the subscription process. Or when you want to simplify your subscription process by just asking only to fill their email address, and you pre-fill the form for them (ie. Set the format to HTML, etc).

There are two ways to achieve this:
  1. Using the API -- Which means:
    • You need to understand how the API works
    • When the subscription process change, your code will also be obsolete (and you need to re-write them)
  2. Using a wrapper that act as an intermediate between your subscription HTML form and the Interspire Email Marketer

On this occasion, I will talk about how to use a wrapper to achieve this. This is because it is fast, and does not require any knowledge of the Interspire Email Marketer inner workings, and in addition, it will shield your code from any changes that are made in the subscription process.

A quick illustration on how this will work is as follow:
+----------------+        +-------------------+       +-----------------------------+
| Your HTML Page |   ==>  | Your PHP page     |  ==>  | Interspire Email Marketter  |
|                |   <==  |                   |  <==  |                             |
+----------------+        +-------------------+       +-----------------------------+

First of all, you need to create a subscription web-form.... Please de-select the option to use CAPTCHA (As we want to keep the subscription form as simple as possible). After the creation is complete, you need to take note of the form ID.

Now the next process is to create your subscription form:
<html>
  <form action="forms_wrapper.php" method="POST">
    Please enter your email address:
    <input type="text" name="txtEmail" />
    <input type="button" name="cmdSubscribe" value="Subscribe" />
  </form>
</html>
And create a PHP wrapper file that will send the request to Interspire Email Marketer:
<?php
  $data = array(
    'format' => 'h',
    'email' => $_POST['txtEmail']
  );
  $ch = curl_init(CONST_YOUR_IEM_URL . '/form.php?form=' . CONST_YOUR_FORMID);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  
  $response = @curl_exec($ch);
  curl_close($ch);
  // Response will contains Interspire Email Marketer response to your subscription.
  // It will either be success (Thank you page)
  // Or it will contains the error page
?>
A working example can be downloaded here If you have any queries about this I will be glad to answer them. Simply leave me a comment bellow.