Solved

Using a URL to return a value

Posted on 2003-11-13
2
183 Views
Last Modified: 2013-12-25
Imagine we have a URL as follows:

www.them.com/cgi-bin/validate.pl?name=alfred

The above URL returns a plain text file, containing the string "true" or "false" based on some internal calculation.

Question: How can I invoke the above URL from within my script to retrieve the return value? (If required, assume my script is at www.me.com/cgi-bin/application.pl)

Ideally, I could write:

$returnValue = www.them.com/cgi-bin/validate.pl?name=alfred

... but of course that's not possible.
0
Comment
Question by:xcab
2 Comments
 
LVL 18

Accepted Solution

by:
kandura earned 100 total points
ID: 9744210
I would do something like this:

use LWP::Simple;
 $content = get("http://www.them.com/cgi-bin/validate.pl?name=alfred");
 die "Couldn't get it!" unless defined $content;

0
 

Author Comment

by:xcab
ID: 9745037
Thanks for your assistance, kandura.

I wouldn't have found that on my own.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now