?
Solved

Polling a URL for string from Shell Script

Posted on 2000-04-20
4
Medium Priority
?
404 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 300 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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…
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.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

777 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