定制 nichin79/curl-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

nichin79/curl-php

最新稳定版本:v1.0.0

Composer 安装命令:

composer require nichin79/curl-php

包简介

Basic curl class for PHP

README 文档

README

Contains two classes:

  • Curl
  • BasicCurl

BasicCurl extends Curl and will automatically use the curlopt's

  • ssl_verifypeer
  • returntransfer. In addition it will also execute the curl automatically.

If curlopt_returntransfer is set, the response can be retrieved with $curl->getResponse().

use Nichin79\Curl\BasicCurl; OR use Nichin79\Curl\Curl;

Setting the params/options for curl can be done in two ways:

Option 1

$data = [
  'url' => 'https://reqbin.com/echo',
  'method' => 'GET', // Method will automatically be set to GET if not specified
  'headers' => [],
  'options' => [
  'SSL_VERIFYPEER' => false
  ]
];

Option 2

$data = [
  'curlopt_url' => 'https://reqbin.com/echo',
  'curlopt_ssl_verifypeer' => false,
];

Usage

$curl = new Curl($data);

// execute the initiated curl and return the response
$curl->exec();

echo "\r\n";
echo "http status code: " . $curl->httpcode;

Setting url, method, headers and data are optional and can be set inside the options array as well.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-10-26