Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

You have a message from the operator.


devel / comp.lang.php / directing curl output to an array or string

SubjectAuthor
* directing curl output to an array or stringbill
`* Re: directing curl output to an array or stringLew Pitcher
 `* Re: directing curl output to an array or stringLew Pitcher
  `* Re: directing curl output to an array or stringbill
   `* Re: directing curl output to an array or stringLew Pitcher
    `- Re: directing curl output to an array or stringbill

1
directing curl output to an array or string

<t0dmg7$1o6j$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=448&group=comp.lang.php#448

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!aioe.org!0Rru9CdXXiQq2r8Rbz8z8A.user.46.165.242.75.POSTED!not-for-mail
From: william@TechServSys.com (bill)
Newsgroups: comp.lang.php
Subject: directing curl output to an array or string
Date: Thu, 10 Mar 2022 15:19:19 -0500
Organization: Aioe.org NNTP Server
Message-ID: <t0dmg7$1o6j$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="57555"; posting-host="0Rru9CdXXiQq2r8Rbz8z8A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: bill - Thu, 10 Mar 2022 20:19 UTC

I would like to direct curl output to a string or an array.

I see how I can direct it to a file and then I could read it back
in to a variable, but it seems there should be a way to just read
the output to a string or array.

Thank you in advance.

-bill

Re: directing curl output to an array or string

<t0dn5p$cbl$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=449&group=comp.lang.php#449

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.php
Subject: Re: directing curl output to an array or string
Date: Thu, 10 Mar 2022 20:30:49 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <t0dn5p$cbl$1@dont-email.me>
References: <t0dmg7$1o6j$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 10 Mar 2022 20:30:49 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2cef377b3ac8ec2ec2e3a1bbd7ec69b7";
logging-data="12661"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19iBMEIgzWmzhYwyRFTDLmMmW5d2D+aeEg="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:rwUkVPAR6Gowmn7r57hhFdKkSjQ=
 by: Lew Pitcher - Thu, 10 Mar 2022 20:30 UTC

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

> I see how I can direct it to a file and then I could read it back
> in to a variable, but it seems there should be a way to just read
> the output to a string or array.

HTH
--
Lew Pitcher
"In Skills, We Trust"

Re: directing curl output to an array or string

<t0dnug$cbl$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=450&group=comp.lang.php#450

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.php
Subject: Re: directing curl output to an array or string
Date: Thu, 10 Mar 2022 20:44:00 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <t0dnug$cbl$2@dont-email.me>
References: <t0dmg7$1o6j$1@gioia.aioe.org> <t0dn5p$cbl$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 10 Mar 2022 20:44:00 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="2cef377b3ac8ec2ec2e3a1bbd7ec69b7";
logging-data="12661"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18LZqR8zbQMHxVhuqSgsy1YfuYxRKfULB8="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:fB7WJLuq9NaFCPofJLlvzBRjrqo=
 by: Lew Pitcher - Thu, 10 Mar 2022 20:44 UTC

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;
?>

--
Lew Pitcher
"In Skills, We Trust"

Re: directing curl output to an array or string

<t0e508$18ib$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=451&group=comp.lang.php#451

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!aioe.org!0Rru9CdXXiQq2r8Rbz8z8A.user.46.165.242.75.POSTED!not-for-mail
From: william@TechServSys.com (bill)
Newsgroups: comp.lang.php
Subject: Re: directing curl output to an array or string
Date: Thu, 10 Mar 2022 19:26:48 -0500
Organization: Aioe.org NNTP Server
Message-ID: <t0e508$18ib$1@gioia.aioe.org>
References: <t0dmg7$1o6j$1@gioia.aioe.org> <t0dn5p$cbl$1@dont-email.me>
<t0dnug$cbl$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="41547"; posting-host="0Rru9CdXXiQq2r8Rbz8z8A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: bill - Fri, 11 Mar 2022 00:26 UTC

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;
> ?>
>
>
>
Thanks Lew.
-bill

Re: directing curl output to an array or string

<t0e8bh$cbl$3@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=452&group=comp.lang.php#452

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: lew.pitcher@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.lang.php
Subject: Re: directing curl output to an array or string
Date: Fri, 11 Mar 2022 01:24:02 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <t0e8bh$cbl$3@dont-email.me>
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>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 11 Mar 2022 01:24:02 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="09128788027c3118de7277704535732d";
logging-data="12661"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DD9JxQorgt85IL9/DpJ4V8gcyNjkxbiI="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:YciEySUKOBvhXMFUfU6Ldp1oI38=
 by: Lew Pitcher - Fri, 11 Mar 2022 01:24 UTC

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"

Re: directing curl output to an array or string

<t0i3vd$1jvm$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=453&group=comp.lang.php#453

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!aioe.org!0Rru9CdXXiQq2r8Rbz8z8A.user.46.165.242.75.POSTED!not-for-mail
From: william@TechServSys.com (bill)
Newsgroups: comp.lang.php
Subject: Re: directing curl output to an array or string
Date: Sat, 12 Mar 2022 07:33:49 -0500
Organization: Aioe.org NNTP Server
Message-ID: <t0i3vd$1jvm$1@gioia.aioe.org>
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>
<t0e8bh$cbl$3@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="53238"; posting-host="0Rru9CdXXiQq2r8Rbz8z8A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.7.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: bill - Sat, 12 Mar 2022 12:33 UTC

On 3/10/2022 8:24 PM, Lew Pitcher wrote:
> 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

Thanks again Lew and apologies for contacting you directly. I
hit the wrong reply button.
-bill

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor