2

As recommended in this question I changed my script to use http_build_query to create a well-formed querystring. This works fine except for a small part.

The interface awaits images, there can be several of them, with the same parameter name for all of them, like this:

&images=$a&images=$b&images=$c

When using http_build_query and passing an array the querystring in the end looks like this:

&images[0]=$a&images[1]=$b&images[2]=$c

This will fail with the interface and so I need to get rid of the indexes at all. I have seen this solution but I´d like to stick to http_build_query.

Any ideas how to do this?

9
  • I think the problem is with your "interface". It's a valid query string. Except for the fact that square brackets should be encoded to "%5B" for "[" and "%5D" for "]". Commented Jun 24, 2016 at 13:16
  • Have you seen if the query parses back to 3 images if you name them all the same key without arraying them? Commented Jun 24, 2016 at 13:18
  • @Wazelin It's not a "problem with the interface" either, it's a mismatch of expectations. Yes, [...] is valid, but if that's not the expected way multiple values are defined, that doesn't help. Commented Jun 24, 2016 at 13:18
  • But it is the correct one. Commented Jun 24, 2016 at 13:19
  • 3
    Anyway you can strip the indexes down like this. Commented Jun 24, 2016 at 13:22

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.