Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strange behaviour wget-command in shell-CGI

Status
Not open for further replies.

Luys

MIS
Aug 17, 2003
7
NL
Hi all,

I am new to CGI, but do know some shell-programming (unfortunately no perl yet). I created a simple script that uses wget to retrieve dynamic data as a static page. But for some reason the wget command is not executed. Here is a test-script:

#!/bin/sh
echo "Content-type: text/html"
echo
echo
echo "<html><head></head>"
echo "<body>"
echo "<pre>"
/usr/bin/wget /usr/bin/wget --help
echo "</pre>"
echo "</body></html>"

Strange thing is, the 'wget --help' command is executed, while the 'wget ' command is completely ignored (or so it seems). I tried lots of different wget commands, and also simple commands like 'ls' and 'who'. Everything I tried seems to be working, except wget-commands other than 'wget --help'

Any ideas will be appreciated!
Richard
 
Richard,

The is probably what you're getting caught up on. Some servers, esp corporate, and profit seeking ones, don't allow wget to their server. Try a simple site, and see if you get results.

You might want to look at LWP in Perl, as you can configure the user agent, and a number of other things to dupe the server. If you use a net sniffer you might see what error responses are being sent back to the client

HTH
--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Thanks Paul,

But I forgot to mention that the 'wget command worked fine from the commandline AND it's a server in our LAN...

While typing this message I tried some other things, and it looks like I found the problem.

Stupid me, it's time to smash my head against the wall! I completely forgot that the webserver which is running this CGI is running as nobody, and is not allowed to create a subdir or a file in the specified directory. Furthermore, I forgot that STDERR is NOT send to the webpage...

Thanks for your help anyway, but it was completely my own fault!

Rgds,
Richard
 
No worries
--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top