This library is Manipulate the Curl library for PHP.

v1.0.1 2017-06-02 05:36 UTC

This package is not auto-updated.

Last update: 2024-09-15 02:31:45 UTC


README

Latest Stable Version Latest Unstable Version License composer.lock

This library is Manipulate the Curl library for PHP.

Installation

With Composer

$ composer require mikuni-labo/curly
{
    "require": {
        "mikuni-labo/curly": "^1.0.0"
    }
}

Example

<?php
require 'vendor/autoload.php';

use MikuniLabo\Curly\Curly;

$ch = new Curly;

$ch->init();
$ch->setUrl('http://example.com/');// Request URL
$ch->setMethod('GET');             // Request Method
$ch->setUserPwd('auth-basic-user-id', 'auth-basic-password');// Auth Basic Credentials
$ch->setHeaderFromArray(array(     // Header
    'Content-type: application/json',
    // More any parameter...
));
$ch->setParameterFromArray(array(  // Request Parameter
    'key' => 'value',
    // More any parameter...
));
$ch->setJsonTransfer(true);
$response = $ch->exec();
$ch->close();

print_r( $response );