Giter Club home page Giter Club logo

php-simple-curl's Introduction

php-simple-curl

A very simple php curl class

Usage

  • Quick Start and Examples
use Khazix\Curl;

$url = "http://www.example.com";

$curl = new Khazix();
$curl->get($url);

if ($curl->error){
  echo $curl->error->code;
  echo $curl->error->msg;
} else {
  echo $curl->code;             //Http code like: 200
  var_dump($curl->result);
}
  • query
$curl->get($url, ["id"=>1]);
  • post data

Content-Type: multipart/form-data;

$data = ['name'=>'khazix', 'msg'=>'ok'];
$curl->post($url, $data);
  • post form data

Content-Type: multipart/form-data;

$curl->post($url, $data, 'form');
  • post json data

Content-Type: application/json;

$curl->post($url, $data, 'json');
  • post xml data

Content-Type: text/xml;

$curl->post($url, $data, 'xml');
  • upload file data

Content-Type: multipart/form-data;

  $data = [
      'file' => '/path/to/logfile',
      'type' => 'log file',
  ];

  $curl->post($url, $data, 'file');
  • put data
$curl->put($url, $data);
  • delete data
$curl->delete($url, ['id'=>3]);
  • set User Agent
$curl->setHeader(['User-Agent: Mozilla/5.0']);
$curl->get($url);
  • set curl Option
$curl->setOption(['CURLOPT_VERBOSE'=>true]);
$curl->get($url);

php-simple-curl's People

Contributors

demonxian3 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.