Hi to all
I have a script to get geo IP which is successfully running on Linux server.but when i run this script on windows server it gives some header error - #!C:/Perl/bin/perl.exe
-
use CGI qw/:standard/;
-
use LWP::UserAgent;
-
use HTTP::Request qw(GET POST);
-
use HTTP::Headers;
-
-
use CGI::Cookie;
-
use CGI::Session;
-
-
use CGI::Carp qw(fatalsToBrowser);
-
-
my $q=new CGI;
-
-
my $c=new CGI::Cookie;
-
-
my $cIP = $ENV{'REMOTE_ADDR'} ;
-
-
# replace this value with license key
-
my $license_key ="key";
-
-
-
my $ua = LWP::UserAgent->new(timeout =>10);
-
-
my $h = HTTP::Headers->new;
-
-
$h->content_type('application/x-www-form-urlencoded');
-
-
my $request = HTTP::Request->new('POST','http://maxmind.com:8010/a',
-
$h,"l=$license_key&i=$cIP");
-
my $res = $ua->request($request);
-
-
my $content = $res->content;
-
#print "Content-type: text/html\n\n" ;
-
############ again send request #######
-
if($content eq "")
-
{
-
sleep(1);
-
-
$request = HTTP::Request->new('POST','http://maxmind.com:8010/a',
-
$h,"l=$license_key&i=$cIP");
-
$res = $ua->request($request);
-
-
$content = $res->content;
-
}
-
if($content eq "")
-
{
-
sleep(1);
-
-
$request = HTTP::Request->new('POST','http://maxmind.com:8010/a',
-
$h,"l=$license_key&i=$cIP");
-
$res = $ua->request($request);
-
-
$content = $res->content;
-
}
-
if($content eq "")
-
{
-
$content="Server-Error";
-
}
-
-
my $session = "" ;
-
-
my $sid = "" ;
-
-
$sid = _Checkcookie();
-
-
if($sid eq "")
-
{
-
$session = new CGI::Session("driver:File", $q, {Directory=>'/tmp'});
-
-
my $server = $ENV{'HTTP_HOST'};
-
-
my $path = "/";
-
-
$sid = $session->id();
-
-
print "Set-Cookie: CGISESSID\=$sid; path\=$path;domain\=$server\n" ;
-
}
-
else
-
{
-
$session = new CGI::Session(undef, $sid, {Directory=>'/tmp'});
-
}
-
-
my $cFlag = 0 ;
-
-
my $referer=$q->param('referer');
-
-
my $albumid=$q->param('albumid');
-
-
my $action=$q->param('action');
-
-
my $shopping_info=$session->param('shopping_info');
-
-
my %shopping_info=%{$shopping_info};
-
-
$shopping_info{geo}=$content;
-
-
-
$session->param("shopping_info",\%shopping_info);
-
-
$session->expire('+12h');
-
-
if($action eq "direct"){
-
#print "location: /cgi-bin/elearning/query/el_alb_details.pl?albumid=$albumid&action=geo\n\n" ;
-
print "Status: 302 Moved", "\r\n","Location: http://www.mysitename.com/cgi-bin/elearning/query/el_alb_details.pl?albumid=$albumid&action=geo", "\r\n\r\n";
-
exit;
-
}
-
-
print 'Status: 302 Moved', "\r\n",'Location:/cgi-bin/elearning/query/el_show_cat.pl', "\r\n\r\n";
-
-
exit;
-
-
sub _Checkcookie{
-
-
my %cookies=fetch CGI::Cookie;
-
-
my $name=$cookies{CGISESSID};
-
-
my @temp=split(/CGISESSID\=/,$name);
-
-
my @temp1=split(/;/,$temp[1]);
-
-
return $temp1[0];
-
}
My error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.
Please help on this
Thanks in advance
Rajiv
2 1958
for now do this, change these lines: - print 'Status: 302 Moved', "\r\n",'Location:/cgi-bin/elearning/query/el_show_cat.pl', "\r\n\r\n";
to: - print 'Location: http://www.yoursite.com/cgi-bin/elearning/query/el_show_cat.pl', "\r\n\r\n";
and see if that gets the script running. If it does, the problem is in the header your script is printing. If not, I don't know what the problem is.
Thanks Kevin,
Actually i am trying to move all script from Linux Server to windows server.No program is work.All script gives the same error.i could not find any problem.But when i run a simple test script its working fine.
My testing script - #!C:/perl/bin/perl.exe
-
use CGI qw/:standard/;
-
-
use CGI::Carp qw(fatalsToBrowser);
-
-
my $q=new CGI;
-
-
my $cFlag = 0 ;
-
-
my $referer=$q->param('referer');
-
-
my $albumid=$q->param('albumid');
-
-
my $action=$q->param('action');
-
-
print $q->header;
-
-
print "Hello world";
-
-
exit;
-
-
Is any server configuration fault has involved in this problem.
Plesae suggest me any idea or solution please.
Thanks in advance
Rajiv
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Massimiliano Alberti |
last post by:
My program is heavily template based, and I use the VC++, so I have to keep
the templates in the header file. My .cpp files are quite empty (they are
more a connection between header files). Now,...
|
by: Steven T. Hatton |
last post by:
In the past there have been lengthy discussiions regarding the role of
header files in C++. People have been very adamat about header files
serving as in interface to the implementation. I do...
|
by: Derrick Coetzee |
last post by:
It seems like, in every C source file I've ever seen, there has been a
very definite include order, as follows:
- include system headers
- include application headers
- include the header...
|
by: Andrew Ward |
last post by:
Hi All,
I was wondering if it is possible to use precompiled headers without having
to include a <stdafx.h> or whatever in every source file.
My problem is that I have a project that makes heavy...
|
by: Lokkju |
last post by:
I am pretty much lost here - I am trying to create a managed c++
wrapper for this dll, so that I can use it from c#/vb.net, however, it
does not conform to any standard style of coding I have seen....
|
by: Peter van der veen |
last post by:
Hi
I have the following problem.
I'm calling a webservice from within a VB.net 2005 Windows program.
For this i got a WSDL file and loaded that in VB.
Until now i just call the webservice and...
|
by: Joseph Geretz |
last post by:
We use a Soap Header to pass a token class (m_Token) back and forth with
authenticated session information. Given the following implementation for
our Logout method, I vastly prefer to simply code...
|
by: jszczepankiewicz |
last post by:
Witam,
mam nastepujacy problem:
XSLT 2.0,
Hi,
i've got following problem with xslt 2:
my xml doc looks something linke:
<manual>
|
by: wdh3rd |
last post by:
Hi everyone. I'm new to C and I have a few questions:
I am making files for permutations and combinations. Files to be made
are perm.c, perm.h, combo.c, and combo.h.
Since both combinations...
|
by: Proogeren |
last post by:
I have a problem with a httpwebrequest that I am creating. The request in itself looks correct but using fiddler I see that a www-authentication header is sent along as well. The code is pasted...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |