Solved

Polling a URL for string from Shell Script

Posted on 2000-04-20
4
391 Views
Last Modified: 2013-12-26
I need to know if the following is possible, and how to accomplish it:

I have a script running on a webserver that returns a string (Ex: "Status=GOOD, Name=Cam")
I want to call this URL from a shell script so that I can parse the string for the values of the variables.

Can someone help?

0
Comment
Question by:camough
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
jonalee earned 100 total points
ID: 2736869
I think the normal sh, csh will not have this function. You can try to use perl. It has socket function. Http is just 80 port. So, open a 80 port connnection, then (I assume that your script is called 1.cgi) send the string:
Get /path/1.cgi\n\n

Then read from the socket, you will get what you need.
0
 

Author Comment

by:camough
ID: 2738007
I am assuming that I would further have to parse the data to exclude typical HTML tags, etc. ?
0
 
LVL 2

Expert Comment

by:jonalee
ID: 2739161
No, you do not need, unless you also want this output be viewed by IE or netscape.
If not, you just use this CGI script to simply output the data you want, no need to write the HTML head (Since that head is only useful to IE kind of web browser)

For example:
You 1.cgi here:

#!/usr/bin/perl

print "Status=GOOD";


0
 

Author Comment

by:camough
ID: 2739366
I think you may have misunderstood the original question:

I want to call a webpage - either html, cgi, asp, ... whatever, and be able to read in to my unix shell script, whatever the data is that the web script spits out.

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 133
Question regarding Copy/Paste 16 96
method notes when mouse over in eclipse 5 87
Hibernate methods 2 77
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 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