?
Solved

Unix script to call web page

Posted on 2009-07-01
4
Medium Priority
?
525 Views
Last Modified: 2012-05-07
I have a sample script given to me by a vendor for calling a function on a web site to retreive a pdf/csv file.

It creates a request


export REQUEST_METHOD=GET export QUERY_STRING="OUTPUT_FMT=CSV&FM_CODE=mlaf070&USER_PROF=OLSOJ25&RPT_
FMT=N&PAPER_SIZE=LETTER&ORIENTATION=P&LINES_PER_INCH=8&RPT_FONT_SIZE=medium"

then it calls another script /cgi-bin/ma.sh ( I dont have access to this folder so I have copied it to a local folder)

when I call it it doesnt seem to do anything, my guess is that I need to execute the file "/cgi-bin/ma.sh" from the web folder location does that make sense? or should the script work from any location?






0
Comment
Question by:JonMny
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 14

Expert Comment

by:sjm_ee
ID: 24754954
Please post the "ma.sh" script.
0
 
LVL 9

Author Comment

by:JonMny
ID: 24755009


#
# source .profile to set all of the required  environment varis.
#
. ~/.profile
# get the request id value from the query string
_REQUEST_ID=`echo \$QUERY_STRING | sed -e "s/.*REQUEST_ID=\\([^&]*\\).*/\\1/"`
 
# I changed this
_FILENAME=/tmp/userlist.csv  
if [ -e $_FILENAME ]
then
    # note: the file we'll dump out has an HTTP header on the front of it.
    cat $_FILENAME
    rm -f $_FILENAME
else
    echo "Content-type: text/plain"
    echo ""
    echo "Document not avail"
    exit 0
fi

0
 
LVL 14

Accepted Solution

by:
sjm_ee earned 2000 total points
ID: 24755684
This script looks like it is supposed to be run as a CGI bin on the web server - it outputs MIME headers and data to a web browser. The way to invoke the script would be to type the following into your web browser:

http://<ip name>/cgi-bin/ma.sh

The exact invocation will depend on how your webserver is setup.
0
 
LVL 9

Author Comment

by:JonMny
ID: 24755802
that's correct, the script is supposed to fake a web request, I think I found the problem.
I am able to call the script the only problem is the environment variables, are those stored in a config for apache?
 
 
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question