javascript - perl cgi script can't post to site - works standalone but fails when running under apache -


i have written perl cgi script fetches html page site using post, processing on html data , prints output html content.

my script url: http://mysite.com/cgi-bin/p.pl

site url: http://site.com/interesting.asp

#!/usr/bin/perl # p.pl ...  sub post_url {     my( $url, $formref ) = @_;     $ua = new lwp::useragent(timeout => 300);     $response = $ua->post($url, $formref );  if( $response->is_success ){     return $response->content; } else {     return undef; } }  $url = 'url: http://site.com/interesting.asp'; %param = ('eno' => '1234', 'submit' => 'submit'); $htmlcontent = post_url( $url, \%param );    # <--- not working  ... processing on $htmlcontent ...  ... print out html page ... 

the script runs fine when run command line fails fetch html page site when run webserver. because script trying access page different domain/ip address? can suggest workaround?

there many causes this. assuming cgi script called (i.e., installed in proper location web server), ensure lwp installed on server. indeed, in various occasions had install manually, ymmv.

it helpful output diagnostics script fails... new lwp::useragent succeed? if so, $response->status_line after post?

edit:

since error message "500 permission denied", web server has blocked outgoing connection. should check whether provider allows outgoing http connection through proxy , configure lwp::useragent. if there no proxy available, possibly there no way go out. cannot here without knowing hosting provider settings, though; maybe can ask hosting provider support...


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -