views:

38

answers:

1

I'm making a call to PayPal's credit card processor, and after a successful/unsuccessful transaction it returns me a string that looks like this:

DoDirectPayment failed: Array ( [TIMESTAMP] => 2010%2d05%2d02T23%3a33%3a28Z [CORRELATIONID] => 8c503f5c6c861 [ACK] => Failure [VERSION] => 51%2e0 [BUILD] => 1268624 [L_ERRORCODE0] => 10527 [L_SHORTMESSAGE0] => Invalid%20Data [L_LONGMESSAGE0] => This%20transaction%20cannot%20be%20processed%2e%20Please%20enter%20a%20valid%20credit%20card%20number%20and%20type%2e [L_SEVERITYCODE0] => Error [AMT] => 90%2e00 [CURRENCYCODE] => USD )

I'm not a javascript pro, but how exactly can I turn that into a parseable array?

Thank you!

A: 

You haven't said what you want to parse it into: PHP, Python, Ruby, Java, JSON...

But whichever it is, if this is a JSON response, google for your server-side language's main JSON parser. Should be a simple one-liner to parse into whatever you need it to be.

fig
ah damn, didn't think to change the incoming data. Looks like it's easy to change the PayPal library file so that it will pre-process. Thanks.
Dan