Link | zoneedit_cname |
Author | Jason Huck |
Category | Utility |
Version | 8.5.x |
License | Public Domain |
Posted | 02 Aug 2007 |
Updated | 02 Aug 2007 |
More by this author... |
Add, remove, and list cnames for the given zone at ZoneEdit.
Methods (see sample usage for exact implementation):
->add - Adds the specified cname/subdomain to the specified target domain. Returns true if successful, false otherwise.
->list - Returns a list of all cnames associated with the given zone as an array of pairs, where the key for each pair is the cname and the value is the ZoneEdit ID for that cname. Required in order to delete a cname.
->remove - Removes the given cname from the given zone. Returns true if successful, false otherwise.
->send - Sends requests to ZoneEdit. Used internally by the other methods.
var('ze') = zoneedit_cname( -zone='mydomain.tld', -username='xxxxxxxxx', -password='xxxxxxxxx' ); $ze->list->size; '
\n'; $ze->add( -cname='auto3', -target='www.mydomain.tld'); $ze->list->size; '
\n'; $ze->remove('auto3'); $ze->list->size;
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define_type( 'cname', -namespace='zoneedit_', -prototype, -description='Add, remove, and list cnames for the given zone at ZoneEdit.' ); local( 'username' = string, 'password' = string, 'zone' = string, 'cname' = string, 'cnames' = array, 'target' = string ); define_tag( 'oncreate', -req='zone', -req='username', -req='password' ); self->zone = #zone; self->username = #username; self->password = #password; /define_tag; define_tag( 'send', -req='post', -encodenone ); local('response') = string; protect; #response = include_url( 'https://www.zoneedit.com/auth/edit.html?zone=' + self->zone + '&type=CNAME', -username = self->username, -password = self->password, -postparams = #post, -timeout = 15 ); /protect; return(#response); /define_tag; define_tag( 'add', -req='cname', -req='target' ); local( 'out' = false, 'response' = string, 'postparams' = array( 'AddNew' = 'Add New Alias', 'dnsfrom' = #cname, 'dnsto' = #target, 'confirm' = 'Yes' ) ); #response = self->send(#postparams); #response >> '' + #cname + '.' ? #out = true; return(#out); /define_tag; define_tag('list'); local( 'response' = string, 'names' = null, 'ids' = null, 'out' = array ); #response = self->send(array); #names = string_findregexp( #response, -find='([a-z0-9\\-\\.]+?)\\.', -ignorecase )->removeall( match_regexp('[a-z0-9\\-\\.]+?\\.') )&; #ids = string_findregexp( #response, -find='', -ignorecase )->removeall( match_regexp('') )&; iterate(#names, local('i')); protect; #out->insert(#i = #ids->get(loop_count)); /protect; /iterate; return(#out); /define_tag; define_tag( 'remove', -req='cname' ); local('cnames') = self->list; protect; local('id') = #cnames->find(#cname)->first->second; handle_error; return(false); /handle_error; /protect; local( 'out' = false, 'response' = string, 'postparams' = array( 'Delete' = 'Delete Selected', 'del' = #id, 'confirm' = 'Yes' ) ); #response = self->send(#postparams); #out = (#response !>> ('' + #cname + '.')); return(#out); /define_tag; /define_type;
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft