Solved

Using a URL to return a value

Posted on 2003-11-13
2
210 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
[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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

631 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