All Projects → php-mod → Curl

php-mod / Curl

Licence: mit
Curl

Labels

Projects that are alternatives of or similar to Curl

php curl
Curl is an open source file transfer tool that uses URL syntax to work on the command line, where the basic functions of curl are encapsulated, such as COOKIES / encrypted transport / HTTP authentication / analog forms / upload files, etc.
Stars: ✭ 38 (-86.62%)
Mutual labels:  curl
diciotto
✈️ A no-nonsense PHP Http client focused on DX (PSR 18 compliant)
Stars: ✭ 23 (-91.9%)
Mutual labels:  curl
Graphqurl
curl for GraphQL with autocomplete, subscriptions and GraphiQL. Also a dead-simple universal javascript GraphQL client.
Stars: ✭ 3,012 (+960.56%)
Mutual labels:  curl
cibase
This is a toolkit for CI/CD provided by Choerodon.
Stars: ✭ 12 (-95.77%)
Mutual labels:  curl
dockerfiles
Dockerfiles everywhere 🐳
Stars: ✭ 17 (-94.01%)
Mutual labels:  curl
MultiHttp
This is a high performance , very useful multi-curl tool written in php. 一个超级好用的并发CURL工具!!!(httpful,restful, concurrency)
Stars: ✭ 79 (-72.18%)
Mutual labels:  curl
FritzBoxShell
Some shell scripts for controlling and checking the Fritz!Box/Fritz!Repeater
Stars: ✭ 80 (-71.83%)
Mutual labels:  curl
Host
Expose your LocalHost with this tool
Stars: ✭ 268 (-5.63%)
Mutual labels:  curl
nycurl
A web server that fetches data from the New York Times and formats it for display in the terminal.
Stars: ✭ 27 (-90.49%)
Mutual labels:  curl
Cake.Curl
🍰↕️ A cross-platform add-in for Cake that allows to transfer files to and from remote URLs using curl.
Stars: ✭ 17 (-94.01%)
Mutual labels:  curl
go-axios
HTTP Request package for golang.
Stars: ✭ 29 (-89.79%)
Mutual labels:  curl
crsync
A library and CLI tool of Client-side rsync over HTTP via curl, implemented by pure C.
Stars: ✭ 21 (-92.61%)
Mutual labels:  curl
request-extra
⚡️ Extremely stable HTTP request module built on top of libcurl with retries, timeouts and callback API
Stars: ✭ 14 (-95.07%)
Mutual labels:  curl
dePAC
seamless Proxy Auto-Config (a.k.a. Web Proxy Auto Discovery) for CLI apps
Stars: ✭ 26 (-90.85%)
Mutual labels:  curl
Php Curl Class
PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs
Stars: ✭ 2,903 (+922.18%)
Mutual labels:  curl
HttpRequest
Simplified HTTP client, A simplie golang HTTP client library.
Stars: ✭ 134 (-52.82%)
Mutual labels:  curl
yab
Call and benchmark YARPC services from the command line.
Stars: ✭ 66 (-76.76%)
Mutual labels:  curl
Requester
Powerful, modern HTTP/REST client built on top of the Requests library
Stars: ✭ 273 (-3.87%)
Mutual labels:  curl
Curl Cheat Sheet
A single page document with the most important curl options for HTTP explained
Stars: ✭ 262 (-7.75%)
Mutual labels:  curl
Auto LFI
A simple Script which tests for LFI (Local File Inclusion) via Curl
Stars: ✭ 17 (-94.01%)
Mutual labels:  curl

PHP Curl Class

This library provides an object-oriented wrapper of the PHP cURL extension.

Maintainability Test Coverage Total Downloads

If you have questions or problems with installation or usage create an Issue.

Installation

In order to install this library via composer run the following command in the console:

composer require curl/curl

or add the package manually to your composer.json file in the require section:

"curl/curl": "^2.0"

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:

  1. Create a fork
  2. Clone the fork to your machine
  3. Install the depencies composer install
  4. Build and start the docker image (in tests/server) docker build . -t curlserver start docker run -p 1234:80 curlserver
  5. Run the unit tests ./vendor/bin/phpunit tests
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].