Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending REST Requests with Symfony2

Is there any bundle that can send REST requests to external web pages? I need PUT and DELETE as well as PATCH (http method).

like image 300
thorben.t Avatar asked Nov 21 '25 20:11

thorben.t


1 Answers

You are looking for this bundle: https://github.com/CircleOfNice/CiRestClientBundle

$restClient = $this->container->get('ci.restclient');

$restClient->get('http://www.someUrl.com');
$restClient->post('http://www.someUrl.com', 'somePayload');
$restClient->put('http://www.someUrl.com', 'somePayload');
$restClient->delete('http://www.someUrl.com');
$restClient->patch('http://www.someUrl.com', 'somePayload');

$restClient->head('http://www.someUrl.com');
$restClient->options('http://www.someUrl.com', 'somePayload');
$restClient->trace('http://www.someUrl.com');
$restClient->connect('http://www.someUrl.com');
like image 70
Tobias Avatar answered Nov 23 '25 13:11

Tobias



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!