APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Perl script to get Numly

Following up on Numly tags help protect your digital content, I wrote a Perl script to fetch Numly ESN's.

I have this script create a ".numly" file in the same directory as the original page; my page display code notices if that file exists and displays it if it does.

So, for example, to create the Numly data for this page, I'd run "getesn.pl //aplawrence.com/Programming/numly_tags.html" and that will create "/Programming/numly_tags.numly" in the appropriate place.

I didn't put a lot of error checking in here, and of course you'd need to modify it for your own particular needs.

See LWP and POST and GET for more on using Perl LWP.

# Numly esn getter
# A.P. Lawrence 2008/01/07
# POST method form
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
chdir($webdir) or exit 1;
$url=shift @ARGV;
chomp $url;
$myfile=~ s/http.*aplawrence.com.//;
# you'd be trimming your domain
$numly=~ s/.html$/.numly/;
if (-e $numly) {
  print "$numly exists!";exit 1;
@description=<I>;close I;
$description= join " ",@description;
foreach (@description) {
  last if $docname;
  # this section will probably be different for you
  if (/<h1>/) {
    $docname=~ s/.*bookmark">//;
    $docname=~ s/<.*//;
 if (not $docname) {
  print "No docname!\n";
  exit 1;

# ready to go get it
my $req= POST 'http://www.numly.com/numly/generate.asp', [
username => 'pcunix',
docname => $docname,
docdesc => $description,
author => 'Anthony Lawrence',
publisher => 'Anthony Lawrence',
licensee => 'Anthony Lawrence',
licemail => 'pcunix at gmail.com',
idonly => 'True',
url => $url];
@stuff = split /\n/,$result;
$FID=~ s/(......)(......)(..)$/-$1-$2-$3/;
print $content; 
print O <<EOF;
alt="numly esn" src="http://numly.com/numly/icon.asp?id=$ID"
border="0" /> $FID<br /><img alt="numly barcode"
/></a><br><br> 2008 All Rights Reserved.</p>
close O;
exit 0;

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Perl script to get Numly

Increase ad revenue 50-250% with Ezoic

More Articles by

Find me on Google+

© Anthony Lawrence

Kerio Connect Mailserver

Kerio Samepage

Kerio Control Firewall

Have you tried Searching this site?

Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

I just had to take the hypertext idea and connect it to the TCP and DNS ideas and — ta-da!— the World Wide Web. ((Tim Berners-Lee)

This post tagged: