Solved

Unix script to call web page

Posted on 2009-07-01
4
524 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 500 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

696 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