PHP GuzzleHttp. How to make a post request with params?

前端 未结 4 470
盖世英雄少女心
盖世英雄少女心 2021-01-30 02:57

How to make a post request with GuzzleHttp( version 5.0 ).

I am trying to do the following:

$client = new \\GuzzleHttp\\Client();
$client->post(
    \         


        
4条回答
  •  遇见更好的自我
    2021-01-30 03:34

    Try this

    $client = new \GuzzleHttp\Client();
    $client->post(
        'http://www.example.com/user/create',
        array(
            'form_params' => array(
                'email' => 'test@gmail.com',
                'name' => 'Test user',
                'password' => 'testpassword'
            )
        )
    );
    

提交回复
热议问题