#!/usr/bin/perl

# Purpose:  Input a url,
#           the program will grab all links on the page
#           and return the resulting links from the pag.
#       If time, use tk.

##################################################
# 1. Create a user agent object
  use LWP::UserAgent;
  my $ua = new LWP::UserAgent;
  $ua->agent("AgentName/0.1 " . $ua->agent);

# 2. Create a request ($req)
  # Constructing the Request Object:
  #  ($method, $uri),           <=== we are using this one
  #  ($method, $uri, $header), 
  #  ($method, $uri, $header, $content) 
  ## $uri    ---- A string, or a reference to a URI object.
  ## $header ---- A reference to an HTTP::Headers object.
  ## $content --- A string. 
  my $req = new HTTP::Request (GET => 'http://www.stilen.com/');

# $r->method([$val]) # $val ---- should be a string. 
# $r->uri([$val])    # $val ---- should be a reference to a URI object OR a string as an ablolute URI 
# $r->as_string()    # takes no aguments, and returns a textual representation of the request

  $req->content_type('application/x-www-form-urlencoded');
  $req->content('match=www&errors=0');
# 3. Pass request to the user agent and get a response back
  my $res = $ua->request($req);

# 4. Print out the results
  print $res->content;
print "##################################################\n";
my $stuff= $res->as_string();
print "$stuff\n";
print "##################################################\n";

##################################################
# lets try this format:
## Create a user agent object
###$ua = LWP::UserAgent->new;
###$request = HTTP::Request->new(GET => 'http://www.420worldwide.com/');
###$response = $ua->request($request);
###print $response->content;

##################################################
