Solved

Polling a URL for string from Shell Script

Posted on 2000-04-20
4
385 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Define unique primary key 9 92
method notes when mouse over in eclipse 5 86
firstChar challenge 13 115
x-bar in Google Sheets 2 52
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 …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

786 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