Passing complex data back when using cURL [message #180171] |
Sun, 20 January 2013 19:42 |
bill
Messages: 310 Registered: October 2010
Karma: 0
|
Senior Member |
|
|
I need to take an array that contains arrays and pass it back to
the script that asked for it using cURL. I have set
CURLOPT_RETURNTRANSFER to 1 so the data comes back to a variable
in the calling program.
The data is alphaneumeric and contains "@" as part of email
addresses.
I want to have the data back in an array or arrays in the calling
script.
I looked at serialize, but fear that the null bytes would not
transfer properly.
I looked at json_encode/decode but wonder about the options.
What would be the best way to move the data from the server back
to the cURL client ?
-bill
|
|
|
Re: Passing complex data back when using cURL [message #180172 is a reply to message #180171] |
Sun, 20 January 2013 19:56 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 1/20/2013 2:42 PM, bill wrote:
> I need to take an array that contains arrays and pass it back to the
> script that asked for it using cURL. I have set CURLOPT_RETURNTRANSFER
> to 1 so the data comes back to a variable in the calling program.
>
> The data is alphaneumeric and contains "@" as part of email addresses.
>
> I want to have the data back in an array or arrays in the calling script.
>
> I looked at serialize, but fear that the null bytes would not transfer
> properly.
>
> I looked at json_encode/decode but wonder about the options.
>
> What would be the best way to move the data from the server back to the
> cURL client ?
>
> -bill
Generally the best way would be to use json. You could also do
something like serialize the data and then base64 encode the data.
Other ways are possible also, but more complicated.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: Passing complex data back when using cURL [message #180173 is a reply to message #180172] |
Sun, 20 January 2013 20:01 |
bill
Messages: 310 Registered: October 2010
Karma: 0
|
Senior Member |
|
|
On 1/20/2013 2:56 PM, Jerry Stuckle wrote:
> On 1/20/2013 2:42 PM, bill wrote:
>> I need to take an array that contains arrays and pass it back
>> to the
>> script that asked for it using cURL. I have set
>> CURLOPT_RETURNTRANSFER
>> to 1 so the data comes back to a variable in the calling program.
>>
>> The data is alphaneumeric and contains "@" as part of email
>> addresses.
>>
>> I want to have the data back in an array or arrays in the
>> calling script.
>>
>> I looked at serialize, but fear that the null bytes would not
>> transfer
>> properly.
>>
>> I looked at json_encode/decode but wonder about the options.
>>
>> What would be the best way to move the data from the server
>> back to the
>> cURL client ?
>>
>> -bill
>
> Generally the best way would be to use json. You could also do
> something like serialize the data and then base64 encode the data.
>
> Other ways are possible also, but more complicated.
>
Thanks Jerry,
simple is good.
bill
|
|
|