0

I am using file_get_contents('php://input') function. How can I convert below data into array?

Content-Disposition: form-data; name="accessKey"

test12313
-----------------------------2154836642318
Content-Disposition: form-data; name="username"

test123
-----------------------------2154836642318--
bobble bubble
  • 16,888
  • 3
  • 27
  • 46
arsal
  • 23
  • 5
  • Into what array? Just to split try [`preg_split('/^(?!\A)(?=Content-Disposition:)/m', $str);`](https://eval.in/844914) – bobble bubble Aug 13 '17 at 13:58
  • I'm confused. Is this supposed to be a standard `multipart/form-data` request? If it is, why do you need to replicate PHP's builtin parser? If it isn't, what's the exact difference? – Álvaro González Aug 13 '17 at 14:42

1 Answers1

1

The answer is found by knowing what to ask:

Manually parse raw HTTP data with PHP

You may be able to get away with using PHP's parse_str function, but there is discussion of a custom solution and links to it when you follow my link.

Brian Gottier
  • 4,522
  • 3
  • 21
  • 37