GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   My first perl script... can one can help! (https://gfy.com/showthread.php?t=138856)

xxxman2 05-31-2003 11:22 PM

My first perl script... can one can help!
 
Hi , I am newbie, I just wrote my first script, but it's doesn't work, the error message is "500 Internal Server Error".
My script calls a script on other server, any ony can help to find out what's error,
I really appreciate your help, thank you!

-----------------------------------------------
#!/usr/bin/perl

$siteid= 'xxxx';
$sitepass= 'xxxx';
$lognm= "xxxx";
$passfile= 'xxxx';
$webemail= '[email protected]';
$sitename= 'xxxx';
$contenturl = 'http://www.contenturl.com/';
$webid = $siteid;
$webfile = 'xxxx';
$reqtype = 'XXXXX';
$username=$FORM{'username'};
$password = $FORM{'password'};
$email= $FORM{'email'};


sub readduser () {
my $addscript = 'http://www.otherserver.com/cgi-bin/add.cgi';
my $query = "siteadd=all&"."webfile=".$webfile."&"."reqtype=". $reqtype."&"."webid=".$webid."&"."passfile=".$pass file.
"&"."webemail=".$webemail."&"."sitename=".$sitenam e."&"."lognm=".$lognm."&"."expire=999999999&"."con tenturl=
".$contenturl."&"."paymentmethod=".$sitename."&"." eml=".$email."&"."username=".$username."&"."passwo rd=".$password;
my $h = new HTTP::Headers;
$h->referer("http://www.mydomain.com/cgi-bin/");
$h->user_agent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461; .NET CLR 1.0.3705)');
$h->authorization_basic($siteid, $sitepass);
my $req = HTTP::Request->new(POST => $addscript, $h);
$req->content_type('application/x-www-form-urlencoded');
$req->content($query);

my $ua = LWP::UserAgent->new;
my $res = $ua->request($req);
my $result = $res->as_string;
if ($result =~ /added/si) {
print "[$key] readded.\n";
}
}
----------------

mrthumbs 05-31-2003 11:37 PM

the script should work.
However it will generate an error when requesting it
through your browser since there is no output defined.

Hell Puppy 06-01-2003 01:24 AM

Two tips:

1) first output to the browser from any perl cgi script needs to be something like this:

print "Content-type: text/html\n\n";

2) when you get a 500 error in the browser, go look at the webserver's error log. it'll usually tell you what the perl error was including the line number.


All times are GMT -7. The time now is 09:38 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123