Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with nested array as POST fields. #20

Closed
stil opened this issue Feb 12, 2012 · 0 comments
Closed

Problem with nested array as POST fields. #20

stil opened this issue Feb 12, 2012 · 0 comments

Comments

@stil
Copy link

stil commented Feb 12, 2012

Consider example:

$request=$this->post('http://example.com');
$request->addPostFields(array(
'a'=>array('b'=>'c')
));```
Result:
Notice: Undefined offset: 0 in D:\library\Guzzle\Http\Message\EntityEnclosingRequest.php on line 130

You need to use "hack":
```<?php
$request=$this->post('http://example.com');
$request->setBody(http_build_query(array(
'a'=>array('b'=>'c')
)));```

Why you didn't use [http_build_query](http://php.net/manual/en/function.http-build-query.php) in Guzzle\Http\QueryString to generate query?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants