Guzzle request doesnt returning my server response

Viewed 20

I'm trying to perform a post from guzzle from a server to another. My need is basically send the data to the server where this data will receive a concatenation and I need to retrieve this modified data on the server that sent the post. Below, the code of I'm trying to do:

Server 1 (where I perform the guzzle post)

        $client = new Client(['base_uri' => 'https://siriustek.com.br/']);
        $response = $client->post('processa-dados', [
            'form_params' => [
                'username' => $request->nome,
                'password' => $request->email
            ]
        ]);

        $contents = $response->getBody()->getContents();
        echo $contents;

Server 2 (Where I receive the data, concatenate the information and show the modified data)

<?php 
    $username = $_POST['username']."MY-STAMPED-DATA";
    echo $username;
?>

However, instead of receive something like jsilmaroviMY-STAMPED-DATA I just receiving MY-STAMPED-DATA. Looks like my post didnt processed correctly. Did I doing something wrong?

0 Answers
Related