CGI shell script curl reponse problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting CGI shell script curl reponse problem
# 1  
Old 09-23-2010
CGI shell script curl reponse problem

Hi,

I am running a bash shell script for some simple web server CGI, the script runs as expected from the browser except the following:

Code:
curl --silent --max-time 10 --output /dev/null --write-out %{http_code} http://server:port/filename

This line outputs 404 when i execute the script from the shell on the server, but from the browser it returns 000.

Any ideas would be welcome, thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Shell script not for CGI

Hello all, I found acontribution of apmcd47 in an article I read very interesting, here is the link: The post is named: I don't understand almost anything about shell scripting, but I'm still determined to learn. I have a question that I have not been able to solve (so many hours at... (9 Replies)
Discussion started by: Haxo
9 Replies

2. Shell Programming and Scripting

shell CGI script

Hi there, I am new to scripting, please advise. I have a script running on the PC server, the script is to log on some ip to get something. script-name IP -l username after running the command, I need to type the password for the script to run. Now, I like to change the script to web... (1 Reply)
Discussion started by: zrcheng
1 Replies

3. Web Development

problem with exporting vairable from one perl cgi to another perl cgi script while redirecting.

Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect. Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is redirected to welcome page. My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies

4. Shell Programming and Scripting

using curl with shell script.

hi please help me out here, i want to use curl command in shell script to test web pages, what i have is an opening page, when i click on a button on opening page, the next page comes up and then i have to upload a file n then click another button to submit and then comes the output... (0 Replies)
Discussion started by: ankushg002
0 Replies

5. UNIX for Dummies Questions & Answers

Problem with CGI Script

Hello, I had to move our company's intranet to a new machine running Centos 5. Whenever cgi scripts now execute I find this error message in the logs: Mon Oct 05 11:19:39 2009] Premature end of script headers: vacation.cgi, referer: https:/{URL}] Could not find platform independent... (0 Replies)
Discussion started by: mojoman
0 Replies

6. Programming

cURL and cgi

I have a CGI application done in c++ that communicates with PayPal. I've had an issue where the application dies when I try to perform a cURL operation. Upon further inspection it seems that I can run cURL examples from the command line. Upon even further inspection it seems that I can run... (8 Replies)
Discussion started by: tatebn
8 Replies

7. Shell Programming and Scripting

call shell script from perl cgi script problem

hi,, i have perl scipt with line : system('./try.sh $t $d $m'); in shell scipt try.sh i have the line: echo $1 its not printing value of $t that i hav passed..y is it so..i am running it from apache web server (2 Replies)
Discussion started by: raksha.s
2 Replies

8. Shell Programming and Scripting

calling a cgi file from shell script????

Hi.. Is it possible to call a cgi program which is used to display a pop up message in the else part...On executing the script it directly prints the source code of the pop up screen.. Please if you have any idea,share with us.Thanks. #start success250=`grep -c failure... (1 Reply)
Discussion started by: elavv
1 Replies

9. Shell Programming and Scripting

invoking a shell script inside cgi shell script

Hi, I have an HTML form through which I get some text as input. i need to run a shell script say script.sh inside a perl-cgi script named main_cgi.sh on the form input. I want to write the contents of the form in a file and then perform some command line operations like grep, cat on the text... (2 Replies)
Discussion started by: smriti_shridhar
2 Replies

10. UNIX for Dummies Questions & Answers

mail script problem using cgi

dear all i've try several scripts and i think this is the simplest scripts that i can understand. please see below:- if ($num >= 4000000001) { #use CGI; #my $query = new CGI; #my $sendmail = "/usr/sbin/sendmail -t"; #my $reply_to = "bla@bla.com"; #my $subject =... (1 Reply)
Discussion started by: unknown2205
1 Replies
Login or Register to Ask a Question
CGI::Emulate::PSGI(3pm) 				User Contributed Perl Documentation				   CGI::Emulate::PSGI(3pm)

NAME
CGI::Emulate::PSGI - PSGI adapter for CGI SYNOPSIS
my $app = CGI::Emulate::PSGI->handler(sub { # Existing CGI code }); DESCRIPTION
This module allows an application designed for the CGI environment to run in a PSGI environment, and thus on any of the backends that PSGI supports. It works by translating the environment provided by the PSGI specification to one expected by the CGI specification. Likewise, it captures output as it would be prepared for the CGI standard, and translates it to the format expected for the PSGI standard using CGI::Parse::PSGI module. CGI.pm If your application uses CGI, be sure to cleanup the global variables in the handler loop yourself, so: my $app = CGI::Emulate::PSGI->handler(sub { use CGI; CGI::initialize_globals(); my $q = CGI->new; # ... }); Otherwise previous request variables will be reused in the new requests. Alternatively, you can install and use CGI::Compile from CPAN and compiles your existing CGI scripts into a sub that is perfectly ready to be converted to PSGI application using this module. my $sub = CGI::Compile->compile("/path/to/script.cgi"); my $app = CGI::Emulate::PSGI->handler($sub); This will take care of assigning an unique namespace for each script etc. See CGI::Compile for details. You can also consider using CGI::PSGI but that would require you to slightly change your code from: my $q = CGI->new; # ... print $q->header, $output; into: use CGI::PSGI; my $app = sub { my $env = shift; my $q = CGI::PSGI->new($env); # ... return [ $q->psgi_header, [ $output ] ]; }; See CGI::PSGI for details. METHODS
handler my $app = CGI::Emulate::PSGI->handler($code); Creates a PSGI application code reference out of CGI code reference. emulate_environment my %env = CGI::Emulate::PSGI->emulate_environment($env); Creates an environment hash out of PSGI environment hash. If your code or framework just needs an environment variable emulation, use this method like: local %ENV = (%ENV, CGI::Emulate::PSGI->emulate_environment($env)); # run your application If you use "handler" method to create a PSGI environment hash, this is automatically called in the created application. AUTHOR
Tokuhiro Matsuno <tokuhirom@cpan.org> Tatsuhiko Miyagawa COPYRIGHT AND LICENSE
Copyright (c) 2009-2010 by tokuhirom. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. SEE ALSO
PSGI CGI::Compile CGI::PSGI Plack CGI::Parse::PSGI perl v5.14.2 2012-03-18 CGI::Emulate::PSGI(3pm)