hstanleycrow/easyphpcurlrequest 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hstanleycrow/easyphpcurlrequest

最新稳定版本:1.0.0

Composer 安装命令:

composer require hstanleycrow/easyphpcurlrequest

包简介

Free PHP Class to make Http Request using cURL

README 文档

README


Easy PHP cURL Request

Free PHP Class to make Http Request using cURL

How To UseDownloadLicense

How To Use

# Clone this repository
$ git clone https://github.com/hstanleycrow/EasyPHPcURLRequest/

# install libraries
$ composer update

# or install using composer
$ composer require hstanleycrow/easyphpcurlrequest

Examples

$url = "https://reqres.in/api/users";
$postData = array(
    'name' => 'John Doe',
    'job' => 'Web Developer'
);
$request = new CurlRequest($url);
$request->setPost(true);
$request->setPostData(json_encode($postData));
$request->setHttpHeader([
    'Content-Type: application/json'
]);
$request->execute();
if ($request->isSuccessful()) :
    $response = $request->getResult();
    $response_data = json_decode($response, true);
    var_dump($response_data);
else :
    echo "Error";
endif;

#example 2: get request
$url = 'https://jsonplaceholder.typicode.com/posts';
$request = new CurlRequest($url);
$request->setPost(false);
$request->setHttpHeader([
    'Content-Type: application/json'
]);
$request->execute();
if ($request->isSuccessful()) :
    $response = $request->getResult();
    $response_data = json_decode($response, true);
    var_dump($response_data);
else :
    echo "Error";
endif;

Download

You can download the latest version here.

PHP Versions

I have tested this class only in this PHP versions. So, if you have an older version and do not work, let me know.

PHP Version
PHP 8.0
PHP 8.1
PHP 8.2

Support

Buy Me A Coffee

License

MIT

www.hablemosdeseo.net  ·  GitHub @hstanleycrow  ·  Twitter @harold_crow

统计信息

  • 总下载量: 17
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固