Solved

Polling a URL for string from Shell Script

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Host to IP 7 84
Path of Workbook 3 87
Detect file exist or not 3 215
Excel file not created as expected 7 106
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.

738 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