Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *@Route("/guzzle/", name="githubapi")
- */
- public function guzzle()
- {
- $client = new \GuzzleHttp\Client();
- $request = $client->request(
- 'POST',
- 'http://127.0.0.1/posts', [
- 'body' => 'username=viiskies&password=flkfasljflaksdj'
- ]);
- $body = $request->getBody();
- $body = json_decode($body, true);
- echo '<pre>';
- var_dump($body);
- echo '</pre>';
- exit;
- }
- /**
- *@Route("/posts", methods="POST")
- */
- public function sendPost()
- {
- return new JsonResponse(['a45454564545' => 'b']);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement