-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
bruce wrote: | hi... | | writing a quick perl script to hit a site... i'm getting the same response, | which appears to be the base site, as opposed to the page i'm trying to | fetch/get...
I am not exactly sure what your expectations are, but...
| | i've simplified things, and am using 3 different approaches to get the | page.. with no luck... | | i've tried using wget | => wget -O fs.txt .... | and i get the same page that i'm getting with my sample routines...
...I get here always the same result as with a browser (Firefox) and
~ perl -MLWP::Simple -e 'print get "http://ap...."'
and
~ wget 'http://apps3.oti....' -O .
In your script you are sending the parameters (with a questions mark????) in the HTTP message body, but they probably should be sent within the URL:
| sub request | { | | my ($url, $term, $dept) = @_; | | my $ua = new LWP::UserAgent; | $ua->timeout(30); | $ua->agent("Mozilla/4.0 (compatible; MSIE 4.0; Windows95)" . $ua->agent); | | my $req = new HTTP::Request GET => $url; | $req->content_type('application/x-www-form-urlencoded'); | | my $cstr; | | $cstr = "?requestType=PUBLIC";
~ ^
| $cstr = $cstr . "&courseNumber="; | $cstr = $cstr . "&term=". uri_escape($term); | $cstr = $cstr . "&department=". uri_escape($dept); | $cstr = $cstr . "&level="; | $cstr = $cstr . "&location=". uri_escape("0100FSU Main Campus"); | $cstr = $cstr . "&specialProgram=-9999"; | $cstr = $cstr . "&beginningTime="; | $cstr = $cstr . "&openSections=Y"; | $cstr = $cstr . "&endingTime="; | $cstr = $cstr . "&searchCriteria=-9999"; | $cstr = $cstr . "&criteriaDesc="; | | | $req->content($cstr); | my $res = $ua->request($req);
What you probably want is
~ my $cstr;
~ $cstr = "requestType=PUBLIC"; ~ $cstr = $cstr . "&courseNumber="; ~ ....
~ my $req = new HTTP::Request GET => $url .'?' . $cstr; ~ $req->content($cstr);
\rho -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFA1PcAKYVIBaAmwTsRApUJAJ9iGYofCfH4r5afvnzrybLnbaMTaACfQYz0 BA47xtC6KO1Gfsn8Q9JIYtk= =do97 -----END PGP SIGNATURE-----