Answer the question
In order to leave comments, you need to log in
How to read the response from the service?
One service sends me this POST:
Array
(
[qw] => qaz
[qwerty] => wsx
[qwerty2] => edc
[qwerty3] => rfv
[qwerty4] => tgb
[qwerty5] => yhn
[qwerty6] =>
)
parse_str(file_get_contents("php://input"),$post_vars);
$qw = $post_vars['qw'];
$qwerty = $post_vars['qwerty'];
$qwerty2 = $post_vars['qwerty2'];
$qwerty3 = $post_vars['qwerty3'];
$qwerty4 = $post_vars['qwerty4'];
$qwerty5 = $post_vars['qwerty5'];
$qwerty6 = $post_vars['qwerty6'];
file_put_contents('test.txt', file_get_contents('php://input'));
Array
(
[qw] => qaz
[qwerty] => wsx
[qwerty2] => edc
[qwerty3] => rfv
[qwerty4] => tgb
[qwerty5] => yhn
[qwerty6] =>
)
Answer the question
In order to leave comments, you need to log in
I correctly understood that the service sends data in the var_dump format? Melkij
pointed out in the
comments that this is more of a print_r output.
Unexpectedly, but there have already been precedents. Reverse parser for var_dump from StackOverflow colleagues. A reverse parser for print_r from php.net commenters and another one from StackOverflow.
Also, perhaps there is a misreading of the documentation.
For example, the description of the specified service does not suspect such a response format at all:
POST - An HTTP POST to a URL of your choosing with transaction details (in either an XML or CSV format)
GET - An HTTP GET to a URL of your choosing with transaction detail you define in the query string.
Dear developers facing similar problems in the future! Make sure you understand the documentation correctly and there really is a need for such parsing tools (;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question