Support Center

Add Subscription CheckBox to Existing Web Forms

Last Updated: Dec 04, 2012 02:44PM EST

 

Introduction
 
The purpose of this API is to enable site owners and developers add a subscription option to existing site registration forms. It reduces the amount of work requried up front to collect subscriptions, and places the subscription option in the same workflow as all other user interactions.
 
The API does not abrogate FeedBlitz's dual opt-in process for new subscriptions. Instead it kick-starts it based on the data entered by the user.  FeedBlitz sends an activation email to the end user, like the standard subscription process. When the user clicks the link they are then prompted to enter any custom fields you may require and complete the standard FeedBlitz image verfication CAPTCHA test (which proves the visitor is a human).  The subscription is then activated. The process is essentially the same as the standard FeedBlitz online subscription process, except in reverse order.
 
Use and Integration
 
Modify your form(s) to include a subscription option (the examples will assume that it is a check box).  Since FeedBlitz uses dual opt-in it is ok to default the chck box to be on (i,e. checked).
On  the server-side script that processes the form submission, call the API below with your API Key and the relevant variables to start the dual opt in process.
Hint: If you get a lot of junk form submissions from bots, write the form using client side scripting (particularly the opening <form> tag) as the vast majority of spam bots do not run client side script. So for a form that opens with this HTML:
 
<form method="POST" action="http://example.com/url">
You can use this script in your HTML markup instead:
 
<script language="Javascript">document.write('<for'+'m method=\"GET\" action=\"http://exa'+'mple.com/url\">');</script>
The script writes out the opening form tag but by breaking the tag into different sections with script it is obfuscated enough that most spam bots won't be able to determine either that a form as been declared, or what the URL it posts to should be, which should therefore dramatically reduce the junk flowing into your back end script.
 
Call
 
http://www.feedblitz.com/f?apisubscriber=<Email>&feedid=<ListID>&key=<APIKey>
 
Parameters
 
All parameters are required and case insensitive except for the API Key.
 
<ListID> - Required: The ID of the mailing to subscribe the reader to. It is required if no other parameters are present.
 
<Email> - Required: The URL encoded email address of the subscriber.
 
<APIKey> - Required: The API Key for your account. This parameter is case sensitive.
 
Examples
 
Subscribe to "FeedBlitz News" updates: http://www.feedblitz.com/f?ApiSubscriber=phil%40feedblitz.com&listid=84&key=secretkey1234 *
 
* You should URL encode the "@" sign in the last example to be "%40" but FeedBlitz will deal with unencoded email addresses just fine.
 
Remarks
 
Here is a PHP code sample:
 
// utility PHP function to fetch any arbirary URL for the sake of the example
// obviously use your own preferred function if you wish!
 
function fbz_get_web_page( $url ){
 
$options = array(
    CURLOPT_RETURNTRANSFER => true, // return web page
    CURLOPT_HEADER => false, // don't return headers
    CURLOPT_FOLLOWLOCATION => true, // follow redirects
    CURLOPT_ENCODING => "", // handle all encodings
    CURLOPT_USERAGENT => "PHP FeedBlitz Web Form Handler", // who am i
    CURLOPT_AUTOREFERER => true, // set referer on redirect
    CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
    CURLOPT_TIMEOUT => 120, // timeout on response
    CURLOPT_MAXREDIRS => 10, // stop after 10 redirects 
);
 
$ch = curl_init( $url ); 
curl_setopt_array( $ch, $options ); 
$content = curl_exec( $ch ); 
$err = curl_errno( $ch ); 
$errmsg = curl_error( $ch ); 
$header = curl_getinfo( $ch ); 
curl_close( $ch ); 
$header['errno'] = $err; 
$header['errmsg'] = $errmsg; 
$header['content'] = $content; 
return $header;
}
 
// define the FeedBlitz API URL to GET once you know that the user has agreed to subscribe using your form
$page='http://www.feedblitz.com/f?apisubscriber='.$email.'&feedid=84&key='.$ApiKey;
 
fbz_get_web_page($page);
 
The above example assumes that the user's email address is in the $email variable, and that the $ApiKey variable holds your secret API Key. Process any errors according to your site's standards.
Feedblitzsupport@gmail.com
http://assets1.desk.com/
false
@feedblitz
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete