Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using a URL to return a value

Posted on 2003-11-13
2
Medium Priority
?
223 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 400 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

772 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