[NCARC] Check out this mash
Michael
michael at frii.com
Fri May 9 09:04:28 EDT 2008
For you APRS and cgi folks. This is an example of 'mashing'. That's
where you hook 2 web pages together through some middle code to produce
something unique. In this case, I grab data from findu.com and send it
to maps.google.com.
Yes, I know there's something like this on findu.com. I like mine better.
go to: www.frii.com/~michael
Either click on the icon: N7MR ??? (on the left menu)
Or enter a tracking callsign in the form field upper center: W0UPS-5
Here is the code that makes this happen:
The findu.com cgi being used is: posit.cgi
Try this in your browser's URL:
www.findu.com/cgi-bin/posit.cgi?call=w0ups-5&start=24&comma=1
Here is my form:
<form action="/cgi-bin/findTracker.cgi" method="POST">
<label for="trackerName">APRS tracker name, ie., N7MR-9: >
<input type="text" name="trackerName" size=10>
<input type=submit value="Show this tracker on google maps">
</form>
This is my cgi that does the mash:
#!/usr/bin/perl
use LWP::Simple;
# incoming from the html form
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
($name, $value) = split(/=/, $buffer);
# call findu.com
$rawData =
get("http://www.findu.com/cgi-bin/posit.cgi?call=$value&start=24&comma=1");
# parse the comma delimited data to the last known position
@rawDataLines = split($/,$rawData);
@rawDataLines = reverse @rawDataLines;
# get rid of the last two html lines
shift @rawDataLines;
shift @rawDataLines;
# Capture the most recently reported location
$mostRecentReportedLocation = shift @rawDataLines;
# Separate that line into lat,long,course,speed,altitude
@llcsa = split(",",$mostRecentReportedLocation);
# Format the google call string
$googleCallString = $llcsa[0].",+".$llcsa[1];
# send html to the browser and voila!
print "Content-type: text/html\n";
print "Location: http://maps.google.com/maps?q=$googleCallString \n\n";
More information about the NCARC
mailing list