PLEASE note: These pages are here solely for historic purposes. New articles have not been written since 2001; many links in the index are broken; and most ahref.com email addresses will now bounce. Try visiting ep Productions, Incorporated, the web programming and development company behind this site.

Tip: Talk with other developers in the discussion forums.

web index ahref.com: a community space for web developers------ -----
IndexToolsCareersTalk
ahref.com > Guides > Technology

Technology Guide

Building a Site Submission Program, Continued

Preliminaries

Lines 1-6 of the program indicate the location of the perl binary on our system and explain the copyright status of the program. The path to Perl is usually /usr/local/bin/perl or /user/bin/perl. Check with your server administrator if you're not sure.

  1 #!/usr/local/bin/perl -w
  2 # Copyright Edward Piou, piou@ahref.com. Originally written for use
  3 # on Anchor [ahref.com], 5/20/1998. Permission granted to use
  4 # this code, in current or altered form, for private or commercial use
  5 # provided these comments are preserved, and any changes to the code are
  6 # noted in comments.

Lines 8-11 import the necessary Perl modules: CGI.pm (for handling the CGI input) and several LWP and HTTP modules (for dealing with HTTP requests). All of these modules are available at CPAN. Line 13 disables output buffering.

  8 use CGI;
  9 use LWP::UserAgent;
 10 use HTTP::Request;
 11 use HTTP::Status;
 12
 13 $| = 1;

Line 15 creates a new CGI object. Line 16 lets the user's browser know that the response page is an HTML document. Lines 17 and 18 use the CGI object to import the information from the form into variables in the program.

 15 $cgi = new CGI;
 16 print $cgi->header;
 17 $input_url = $cgi->param('input_url');
 18 $input_email = $cgi->param('input_email');

Lines 20-22 define several variables containing information unique to our site. This is information you should change if you copy the program. $our_ip is the IP address of the machine running the site submitter. It needs to be defined because one of the search engines (Hotbot) requires an IP address for submissions. Use your own IP address, rather than a user's IP address, so that if there is a problem with the program, Hotbot will know it is our machine that is causing problems. Lines 21 and 22 define our header and footer files. These files include the HTML code which goes before and after the dynamic output of the program.

 20 my $our_ip = "205.177.109.84";
 21 my $HEADER = "/documentpath/header.inc";
 22 my $FOOTER = "/documentpath/footer.inc";
continue reading >>>
or jump to a topic:

Introduction
Preliminaries
Input Validation
Defining the Search Engines
More Variable Setup
Making the Submissions
Finishing Up
Things to Keep in Mind


view a printable version of this article


To suggest a topic, please email guides@ahref.com.

 


HOME ||| ABOUT AHREF.COM ||| ADVERTISE ||| FEEDBACK ||| SEARCH THIS SITE ||| CONTRIBUTE

© 1998-1999 ep Productions, Inc. All rights reserved. Terms of use.