CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Can't seem to do a POST request.

 



ferulebezel
New User

Oct 18, 2012, 12:09 AM

Post #1 of 2 (1728 views)
Can't seem to do a POST request. Can't Post

     

Code
my $userAgent=new LWP::UserAgent; 
my $otherResponse = $userAgent->post("http://www.textbooks.co/BuyBack-Search.php", ["bb_isbns" => $bookData{'searchNumber'},]);


My script crashes at the second line.
The hash value has been checked for definedness.
I have no access to the error log.

What is wrong?


wickedxter
User

Oct 20, 2012, 7:58 PM

Post #2 of 2 (1720 views)
Re: [ferulebezel] Can't seem to do a POST request. [In reply to] Can't Post


Code
 
use strict;
use warnings;

use WWW::Mechanize;

my $mech = WWW::Mechanize->new();

$mech->agent_alias('Windows Mozilla');

$mech->get('http://www.textbooks.co/BuyBack-Search.php');

#this selects the search box
$mech->form(1);

$mech->set_feilds(
price_group => 'buy',
key_val => $bookData{'searchNumber'},
);
#submit the form data
$mech->submit();

#get the page content
my $content = mech->content();


i like useing WWW::Mechanize which makes things easier to do.. this is untested... When looking at the page source their was some jave script call backs for the fourm that on submit it checked something but dont know what. So youll have to tinker with this..


(This post was edited by wickedxter on Oct 20, 2012, 7:58 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives