【php】php有没有请求 restful 接口的类库?
ringa_lee
ringa_lee 2017-06-10 09:47:29
0
3
818

之前开发手写了curl的方法,支持get和post请求

现在要用 put 和 delete 方法,我想找一个专门负责请求的类库,不知有没有?最好能 composer 安装,谢谢

ringa_lee
ringa_lee

ringa_lee

全部回复(3)
我想大声告诉你

https://packagist.org/package... 这个

我想大声告诉你

guzzle,requests比较常用

typecho

A proper REST client for php 一直在用这个,还不错。

<?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');

?>
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!