سؤال

Working a bit with PayPal and stumbled on the NVP response. I´m used to working with JSON and XML as a response format. But have never worked with the NVP "simplified" format. Why aren´t they and others using JSON/XML instead of NVP?

A list can look like this SomeList.Item(0).name

Is there a good way to work with NVP in PHP?

Hope somebody can explain the pros with NVP over JSON and XML and a way to work with NVP in PHP. Like how to iterate through a list.

هل كانت مفيدة؟

المحلول

you can use PHP's parse_str() function. It parses a string like

user=test&password=123

into a PHP array in this form:

Array
(
    [user] => test
    [password] => 123
)

نصائح أخرى

You are probably looking for the function parse_str

Here is another example I found.

Parse Paypal NVP in PHP

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top