• directing curl output to an array or string

    From bill@21:1/5 to All on Thu Mar 10 15:19:19 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Lew Pitcher on Thu Mar 10 20:44:00 2022
    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"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to bill on Thu Mar 10 20:30:49 2022
    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"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bill@21:1/5 to Lew Pitcher on Thu Mar 10 19:26:48 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to bill on Fri Mar 11 01:24:02 2022
    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"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From bill@21:1/5 to Lew Pitcher on Sat Mar 12 07:33:49 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)