Giter VIP home page Giter VIP logo

curl's Introduction

weikaiii-curl

方便curl使用,支持链式操作,简化curl常用操作

版本要求

PHP 5.3 +

Laravel/Lumen >= 5.1

Composer

安装

composer require weikaiii/curl dev-master

配置

Laravel 应用

  1. config/app.php 注册 ServiceProvider 和 Facade (Laravel 5.5 无需手动注册)
'providers' => [
    // ...
     Weikaiii\Curl\CurlServiceProvider::class,
],
'aliases' => [
    // ...
   'Curl' => Weikaiii\Curl\CurlClass::class,
],

使用

#####GET:

$content = Curl::init()->url(目标url)->get(数组参数);
POST:
Curl::init()->url(目标url)->post(数组参数);
保存生成的选项:
Curl::init()->url(目标url)->header($header)->cookie($cookie)->save();

下面可以直接用 保持上面的请求头和cookie
Curl::init()->post($data);

Curl::init()->file('img.jpg')->post();
设置参数
Curl::init()->set('CURLOPT_选项', 值)->url(目标url);

#####设置超时60秒

Curl::init()->time('60')->url(目标url);
设置证书
Curl::init()->cacert('证书文件路径')->url(目标url);
设置cookie
Curl::init()->cookie($cookie)->url(目标url);
设置header
Curl::init()->header($header)->url(目标url);
设置language
Curl::init()->language($language)->url(目标url);
设置agent
Curl::init()->agent($agent)->url(目标url);

curl's People

Contributors

kayw-geek avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.