KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm working with a third party API that receives several parameters which must be encoded like this: text[]=Hello%20World&text[]=How%20are%20you?&html[]=<p>Just%20fine,%20thank%20you</p> As you can see this API can accept multiple parameters for text, and also for HTML (not in the sample call). I have used http_build_query to correctly build a query string for other APIs $params['text'][] = 'Hello World'; $params['text'][] = 'How are you?'; $params['html'][] = '<p>Just fine, thank you</p>'; $http_query = http_build_query($params); The problem with this approach is that it will build a query string with the numeric index: text[0]=Hello%20World&text[1]=How%20are%20you?&html[0]=<p>Just%20fine,%20thank%20you</p> unfortunately the API I'm working with doesn't like the numeric index and fails. Is there any php function/class-method that can help me build a query like this quickly? Thank you
Tags (comma-separated)
Save Edits
Cancel