Http Fetch Field
You can specify that Lyris List Manager retrieve data from a remote machine using the httpget merge tag. This data must be accessible via http. The syntax of the
httpget Mail Merge tag is:
<!-- merge type=["httpget" | "httpgetonce"] URL=[URL] -->
Notice the merge syntax is nested in an HTTP comment tag.
The URL argument can be virtually anything you can pull up with a web browser. The URL may point to a simple text file, some HTML code, or a CGI script.
For example, consider you want to retrieve an ad you are running on your web server and the URL is http://yourserver/cgi-bin/ad.pl; you would accomplish this by using the following merge tag:
<!-- merge type="httpget" URL="http://yourserver/cgi-bin/getdata.pl" -->
The above example will repeatedly retrieve the data for each recipient. If, however, you only need to retrieve the data once, you can use the httpgetonce tag instead. The
following example illustrates this usage:
<!-- merge type="httpgetonce" URL="http://localhost/cgi-bin/getdata.pl" -->
The following example shows how to use this to fetch custom data for your member:
<!-- merge type="httpget" URL="http://localhost/cgi-bin/getdata.pl?id=$subst(Recip.Email)" -->
In the above example, Lyris List Manager first performs a substitution to merge in the member's email address, then retrieves the data at the resulting URL. Let's assume that
bob@somewhere.com is the member that Lyris List Manager is currently sending to. After substitution, the URL looks like:
http://localhost/cgi-bin/getdata.pl?id=bob@somewhere.com
The nature of the script being called ("getdata.pl" in this case) is to generate some data unique to the member with that email address. This script can do whatever you
design it to do, whether that means generating an ad or retrieving billing information.
For programmers, this means you have the ability to call a function in the middle of your message and insert whatever it returns right into the message at the point from which it was called.
While the httpget merge tag does not require any specific output from the URL, it is highly recommended that you include a standard 'HTTP/1.0 200 OK' status line, then a 'Content-Type:
text/plain', or 'Content-Type: text/html' line followed by an empty line and the content of the text to be inserted. For example, a (Perl) script might have:
print "HTTP/1.0 200 OK\r\n"; print "Content-Type: text/plain\r\n"; print "\r\n"; print "$GetCurrentTime()\r\n";
It is very likely that a future version of Lyris List Manager will take into account the content-type when it processes the result.
|