2017 © Pedro PelĂĄez
 

library curl

cURL class for PHP .change function setOpt to return $this for chan operation

image

bjz/curl

cURL class for PHP .change function setOpt to return $this for chan operation

  • Saturday, July 21, 2018
  • by baijunzhen
  • Repository
  • 0 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 80 Forks
  • 0 Open issues
  • 23 Versions
  • 0 % Grown

The README.md

PHP Curl Class

This library provides an object-oriented wrapper of the PHP cURL extension., (*1)

If you have questions or problems with installation or usage create an Issue., (*2)

Installation

In order to install this library via composer run the following command in the console:, (*3)

composer require curl/curl

or add the package manually to your composer.json file in the require section:, (*4)

"curl/curl": "^1.5"

Usage examples

$curl = new Curl\Curl();
$curl->get('http://www.example.com/');
$curl = new Curl\Curl();
$curl->get('http://www.example.com/search', array(
    'q' => 'keyword',
));
$curl = new Curl\Curl();
$curl->post('http://www.example.com/login/', array(
    'username' => 'myusername',
    'password' => 'mypassword',
));
$curl = new Curl\Curl();
$curl->setBasicAuthentication('username', 'password');
$curl->setUserAgent('');
$curl->setReferrer('');
$curl->setHeader('X-Requested-With', 'XMLHttpRequest');
$curl->setCookie('key', 'value');
$curl->get('http://www.example.com/');

if ($curl->error) {
    echo $curl->error_code;
}
else {
    echo $curl->response;
}

var_dump($curl->request_headers);
var_dump($curl->response_headers);
$curl = new Curl\Curl();
$curl->setOpt(CURLOPT_RETURNTRANSFER, TRUE);
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, FALSE);
$curl->get('https://encrypted.example.com/');
$curl = new Curl\Curl();
$curl->put('http://api.example.com/user/', array(
    'first_name' => 'Zach',
    'last_name' => 'Borboa',
));
$curl = new Curl\Curl();
$curl->patch('http://api.example.com/profile/', array(
    'image' => '@path/to/file.jpg',
));
$curl = new Curl\Curl();
$curl->delete('http://api.example.com/user/', array(
    'id' => '1234',
));
$curl->close();
// Example access to curl object.
curl_set_opt($curl->curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1');
curl_close($curl->curl);
// Example of downloading a file or any other content
$curl = new Curl\Curl();
// open the file where the request response should be written
$file_handle = fopen($target_file, 'w+');
// pass it to the curl resource
$curl->setOpt(CURLOPT_FILE, $file_handle);
// do any type of request
$curl->get('https://github.com');
// disable writing to file
$curl->setOpt(CURLOPT_FILE, null);
// close the file for writing
fclose($file_handle);

 Testing

In order to test the library:, (*5)

  1. Create a fork
  2. Clone the fork to your machine
  3. Install the depencies composer install
  4. Run the unit tests ./vendor/bin/phpunit tests

The Versions

21/07 2018

dev-master

9999999-dev https://github.com/baijunzhen/curl

cURL class for PHP .change function setOpt to return $this for chan operation

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

23/05 2018

1.9.1

1.9.1.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

02/05 2018

1.9.0

1.9.0.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

12/08 2017

1.8.0

1.8.0.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

09/08 2017

1.7.1

1.7.1.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

28/07 2017

1.7.0

1.7.0.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

03/04 2017

1.6.1

1.6.1.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

13/01 2017

1.6.0

1.6.0.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

20/10 2016

1.5.0

1.5.0.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

04/06 2016

1.4.0

1.4.0.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

16/12 2015

1.3.0

1.3.0.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

09/08 2015

2.x-dev

2.9999999.9999999.9999999-dev https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *

 

The Development Requires

curl

09/04 2015

1.2.1

1.2.1.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

08/03 2015

2.0.0-alpha1

2.0.0.0-alpha1 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *

 

The Development Requires

curl

13/02 2015

dev-version-1

dev-version-1 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

11/12 2014

1.2.0

1.2.0.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-curl *

 

The Development Requires

curl dot

14/08 2014

1.1.5

1.1.5.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

curl dot

22/06 2014

1.1.4

1.1.4.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

curl dot

19/05 2014

1.1.3

1.1.3.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

curl dot

09/04 2014

1.1.2

1.1.2.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

curl dot

26/03 2014

1.1.1

1.1.1.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

curl dot

04/11 2013

v1.1.0

1.1.0.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

curl dot

03/11 2013

1.0

1.0.0.0 https://github.com/php-mod/curl

cURL class for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

curl dot