Posting HTTP Data

If you are a software developer and you wish your software to post subscriptions and unsubscriptions to arpReach, this section explains how to do it.

  • Create a subscription form in arpReach
  • Post data to it using an HTTP request from your software

Create and save a form in the Subscription Forms section of the autoresponder. Then generate the form html code there, too. From this you can see the fields you need to map to. Note the “POST” URL is different for every form because most of the form’s parameters are held in the database instead of “hidden” form fields.

Here’s an example with the form code and associated PHP code. Note the “action” field of the form tag, which is unique for every form stored in arpReach. Also, note that the USER_AGENT is mandatory in the curl post or it will be ignored. It doesn’t matter what you set it to. This is really just a defense against spambots that often don’t bother to have a user agent.

Example Form Code

<!-- subscription_form_lwzysh --> 
<div id=’subscription_form_lwzysh’>
<form method=’post’ action=’https://yourdomain.com/arpreach/a.php/sub/1/lwzysh’>
<div>
<label>Email address</label>
<input type=’text’ id=’email_address’ name=’email_address’ value=’’>
</div>
<div>
<label>First name</label>
<input type=’text’ id=’first_name’ name=’first_name’ value=’’> 
</div>
<div>
<input type=’submit’ value=’Submit’>
</div>
</form>
</div>
<!-- subscription_form_lwzysh -->

Example PHP Code – Subscribe

define(URL, ‘https://yourdomain.com/arpreach/a.php/sub/1/lwzysh‘);
if (! empty($_POST) && count($_POST) > 0) { 

$post_fields = array(

‘email_address’ => ‘whatever@whatever.com’, 
‘first_name’ => ‘first_name_here’,
‘last_name’ => ‘last_name_here’);

$ch = curl_init();

curl_setopt($ch, CURLOPT_USERAGENT, ‘ARPR’); 
curl_setopt($ch, CURLOPT_URL, URL);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); 
curl_exec($ch);

curl_close($ch);

} // if