composer require guzzlehttp/guzzle
GET REQUEST
public function getGuzzleRequest()
{
$client = new \GuzzleHttp\Client();
$request = $client->get('http://example.com');
$response = $request->getBody();
dd($response);
}
POST REQUEST
public function postGuzzleRequest()
{
$client = new \GuzzleHttp\Client();
$url = "http://example.com/api/posts";
$data['name'] = "codechief";
$request = $client->post($url, ['body'=>$data]);
$response = $request->send();
dd($response);
}
PUT REQUEST
public function putGuzzleRequest()
{
$client = new \GuzzleHttp\Client();
$url = "http://example.com/api/posts/1";
$data['name'] = "codechief";
$request = $client->put($url, ['body'=>$data]);
$response = $request->send();
dd($response);
}
DELETE REQUEST
public function deleteGuzzleRequest()
{
$client = new \GuzzleHttp\Client();
$url = "http://example.com/api/posts/1";
$request = $client->delete($url);
$response = $request->send();
dd($response);
}
Tuesday, 9 February 2021
Guzzle Http Client Request
Subscribe to:
Post Comments (Atom)
Machine Learning - Potato Leaf Disease Prediction
Step 1: import numpy as np import pandas as pd import splitfolders import matplotlib.pyplot as plt import tensorflow as tf from tensorflow i...
-
Step1: composer create-project laravel/laravel canpac Step2: cd canpac Step3: composer require laravel/ui Step4: php artisan ui bootst...
-
1. Create a middleware name PostShortCodeMiddleware 2. Add this middleware in the kernal file. 3. Create a shortcode.php and shorcodeurl.php...
Thank you for sharing this informative post. Looking forward to reading more.
ReplyDeleteLaravel Development Services
Good Job! I will refer the people to the best IT Solutions providers click the below link:
ReplyDeleteIT Consulting Melbourne
affordable seo packages
ppc company australia
content marketing agency melbourne
social media marketing company
web development australia
app development melbourne
seo packages
social media marketing packages
Cre8tivebot
Thanks a lot for your interesting article. I have been searching for such message for a very long time. Not all your content is completely clear to me, even though it is definitely interesting and worth reading. Goviralhost Review
ReplyDelete