0

Im just want to ask if anyone knows how i can post multiple data with the POST request. This works:

$data = array(
'post_params'=>[
  'Name'=>'Foo',
  'LastName'=>'Bar'
]
);

This dosent work: any alternatives?

$data = array(
'post_params'=>[
  'Name'=>'Foo',
  'LastName'=>'Bar'
],
'post_params'=>[
  'Name'=>'Foo',
  'LastName'=>'Bar'
]
);

Ho can i send multiple post data at once?

Webbie
  • 537
  • 2
  • 10
  • 25
  • Possible duplicate of [How to perform multiple Guzzle requests at the same time?](http://stackoverflow.com/questions/19520185/how-to-perform-multiple-guzzle-requests-at-the-same-time) – Saeed M. Jun 09 '16 at 07:34

1 Answers1

0

You can't do it that way just because that's not how requests work, you can append nearly as many attributes as you want, but not nested arrays of data.

Gonna have to do it this way:

$data = array(
  'post_params'=>[
    'Name1'=>'Foo',
    'LastName1'=>'Bar',
    'Name2'=>'Foo',
    'LastName2'=>'Bar'
  ]
);
Borjante
  • 9,767
  • 6
  • 35
  • 61