1

I have some API instructions I am trying to follow

(string) source (string) key (string) params[file] (string) params[gender] (int) params[age]

I get how to make the API calls but where it has an array for params (file, gender and age) how to I put that into a query string?

The call works with something like this:

GET https://api-url.com/api?source=lorem&key=dolor

But how would I append that with the params? params[file]=file_name.gif ??

That doesn't seem to work but I'm open to the fact something else could be wrong - just wanted to check how you pass an array in a query string?

Thanks

1 Answer 1

3

Yes it's params[file]=xy in the query string:

your-url/api?source=lorem&key=dolor&params[file]=file_name.gif&params[age]=23..

Access in PHP: $yourfile = $_GET['params']['file'];

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.