[php] Does PHP have a class library that requests restful interface?
ringa_lee
ringa_lee 2017-06-10 09:47:29
0
3
861

I previously developed a handwritten curl method that supports get and post requests

Now I need to use the put and delete methods. I want to find a class library that is specifically responsible for requests. Is there one? It is best to install it through composer, thank you

ringa_lee
ringa_lee

ringa_lee

reply all(3)
我想大声告诉你

https://packagist.org/package... This

我想大声告诉你

guzzle, requests are more commonly used

typecho

A proper REST client for php I have been using this and it is pretty good.

<?php

$pest = new Pest('http://example.com');

$thing = $pest->get('/things');

$thing = $pest->post('/things', 
    array(
        'name' => "Foo",
        'colour' => "Red"
    )
);

$thing = $pest->put('/things/15',
    array(
        'colour' => "Blue"
    )
);

$pest->delete('/things/15');

?>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!