Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 55755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:25:37+00:00 2026-05-10T17:25:37+00:00

I have some code I’ve written in PHP for consuming our simple webservice, which

  • 0

I have some code I’ve written in PHP for consuming our simple webservice, which I’d also like to provide in Perl for users who may prefer that language. What’s the simplest method of making a HTTP request to do that? In PHP I can do it in one line with file_get_contents().

Here’s the entire code I want to port to Perl:

/**  * Makes a remote call to the our API, and returns the response  * @param cmd {string} - command string ID  * @param argsArray {array} - associative array of argument names and argument values  * @return {array} - array of responses  */ function callAPI( $cmd, $argsArray=array() ) {    $apikey='MY_API_KEY';    $secret='MY_SECRET';    $apiurl='https://foobar.com/api';     // timestamp this API was submitted (for security reasons)    $epoch_time=time();     //--- assemble argument array into string    $query = 'cmd=' .$cmd;    foreach ($argsArray as $argName => $argValue) {        $query .= '&' . $argName . '=' . urlencode($argValue);    }    $query .= '&key='. $apikey . '&time=' . $epoch_time;     //--- make md5 hash of the query + secret string    $md5 = md5($query . $secret);    $url = $apiurl . '?' . $query . '&md5=' . $md5;     //--- make simple HTTP GET request, put the server response into $response    $response = file_get_contents($url);     //--- convert '|' (pipe) delimited string to array    $responseArray = explode('|', $response);    return $responseArray; } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:25:38+00:00Added an answer on May 10, 2026 at 5:25 pm

    LWP::Simple:

    use LWP::Simple; $contents = get('http://YOUR_URL_HERE'); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Any time you're going to move binary data from one… May 11, 2026 at 2:08 pm
  • added an answer Enclose the field in double quotes. Double up any embedded… May 11, 2026 at 2:08 pm
  • added an answer You want to use the listings package. Is there a… May 11, 2026 at 2:08 pm

Related Questions

I have some code I've written in PHP for consuming our simple webservice, which
I have some code where I'm returning an array of objects. Here's a simplified
I have some code which I am making available via RMI. If my program
I have some code that I am putting in the code-behind of a master
I have some code which I did not originally create that uses _beginthreadex and
I have some code I write inside the verbatim environment. Sometimes, the lines are
I have some code from my VB.NET 1.1 days that allowed me to dynamically
Anyone know if it is possible to write an app that uses the Java

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.