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 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.
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;
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;
Please explain the "something like"
Thanks Lew.
-bill
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
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 158:37:08 |
| Calls: | 12,094 |
| Calls today: | 2 |
| Files: | 15,000 |
| Messages: | 6,517,756 |