Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #18883

Re: directing curl output to an array or string

From Lew Pitcher <lew.pitcher@digitalfreehold.ca>
Newsgroups comp.lang.php
Subject Re: directing curl output to an array or string
Date 2022-03-11 01:24 +0000
Organization A noiseless patient Spider
Message-ID <t0e8bh$cbl$3@dont-email.me> (permalink)
References <t0dmg7$1o6j$1@gioia.aioe.org> <t0dn5p$cbl$1@dont-email.me> <t0dnug$cbl$2@dont-email.me> <t0e508$18ib$1@gioia.aioe.org>

Show all headers | View raw


On Thu, 10 Mar 2022 19:26:48 -0500, bill wrote:

> On 3/10/2022 3:44 PM, Lew Pitcher wrote:
>> On Thu, 10 Mar 2022 20:30:49 +0000, Lew Pitcher wrote:
>> 
>>> On Thu, 10 Mar 2022 15:19:19 -0500, bill wrote:
>>>
>>>> I would like to direct curl output to a string or an array.
>>>
>>> See the first example on
>>>    https://www.php.net/manual/en/curl.examples.php
>> 
>> or, did you mean something like
>> 
>> <?php
>>    exec("curl http://google.com/",$OUTPUT,$RC);
>>    echo $OUTPUT;
>> ?>

To answer the question you asked me offline

> Please explain the "something like"

while PHP has a built-in cURL interface (in the curl_* functions),
you can also use the php exec() function to execute the standalone
curl command.

https://www.php.net/manual/en/function.exec.php
explains the parameters to this function.

The array (that I named $OUTPUT) will contain the data returned
by the curl command, satisfying your quest to "direct curl output
to ... an array".

The argument that I named $RC will contain the return status of the
curl command.


> Thanks Lew.
> -bill

You are very welcome.

Luck be with you
-- 
Lew Pitcher
"In Skills, We Trust"

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

directing curl output to an array or string bill <william@TechServSys.com> - 2022-03-10 15:19 -0500
  Re: directing curl output to an array or string Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2022-03-10 20:30 +0000
    Re: directing curl output to an array or string Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2022-03-10 20:44 +0000
      Re: directing curl output to an array or string bill <william@TechServSys.com> - 2022-03-10 19:26 -0500
        Re: directing curl output to an array or string Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2022-03-11 01:24 +0000
          Re: directing curl output to an array or string bill <william@TechServSys.com> - 2022-03-12 07:33 -0500

csiph-web