Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
lib/curl_cookie.txt
lib/veqryn/Curl/curl_cookie.txt
.idea/
vendor/
build/
composer.lock
composer.phar
/logs/*
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "test/ztest"]
path = test/ztest
url = git://github.com/jaz303/ztest.git
36 changes: 26 additions & 10 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ A basic CURL wrapper for PHP (see [http://php.net/curl](http://php.net/curl) for

## Installation

Click the `download` link above or `git clone git://github.com/shuber/curl.git`
Click the `download` link above or `git clone git@github.com:veqryn/curl.git`

To install into your project, add these lines to your composer.json:

"require": {
"veqryn/curl": "*"
}


## Usage
Expand All @@ -14,8 +20,15 @@ Click the `download` link above or `git clone git://github.com/shuber/curl.git`

Simply require and initialize the `Curl` class like so:

require_once 'curl.php';
$curl = new Curl;
require_once('vendor/autoload.php');

use veqryn\Curl\Curl;
use veqryn\Curl\CurlResponse;
use veqryn\Curl\CurlException;

// ...

$curl = new Curl();


### Performing a Request
Expand All @@ -34,9 +47,9 @@ To use a custom request methods, you can call the `request` method:

All of the built in request methods like `put` and `get` simply wrap the `request` method. For example, the `post` method is implemented like:

function post($url, $vars = array()) {
return $this->request('POST', $url, $vars);
}
public function post($url, $vars = array(), $enctype = null) {
return $this->request('POST', $url, $vars, $enctype);
}

Examples:

Expand All @@ -47,7 +60,7 @@ Examples:

$response = $curl->post('test.com/posts', array('title' => 'Test', 'body' => 'This is a test'));

All requests return a CurlResponse object (see below) or false if an error occurred. You can access the error string with the `$curl->error()` method.
All requests return a CurlResponse object (see below) or throw a CurlException if an error occurred. You can access the error string with the `$curl->error()` method.


### The CurlResponse Object
Expand Down Expand Up @@ -130,11 +143,14 @@ You can set/override many different options for CURL requests (see the [curl_set

## Testing

Uses [ztest](http://github.com/jaz303/ztest), simply download it to `path/to/curl/test/ztest` (or anywhere else in your php include_path)
Uses [phpunit](https://phpunit.de/). Simply run phpunit in the 'test' directory.
Example on linux (assuming php is on your path):

cd <project_root_dir>/test
../vendor/bin/phpunit

Then run `test/runner.php`


## Contact

Problems, comments, and suggestions all welcome: [shuber@huberry.com](mailto:shuber@huberry.com)
Problems, comments, and suggestions all welcome: [shuber@huberry.com](mailto:shuber@huberry.com) and/or VEQRYN [at] hotmail dot com
44 changes: 41 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
{
"name": "shuber/curl",
"name": "veqryn/curl",
"license": "MIT",
"keywords": ["curl","spider", "bot", "scraper"],
"keywords": [
"curl",
"spider",
"bot",
"scraper",
"php",
"wrapper"
],
"homepage": "https://github.com/veqryn/curl",
"type": "library",
"description": "PHP Wrapper for Curl",
"authors": [
{
"name": "Sean Huber",
"email": "shuber@huberry.com",
"homepage": "https://github.com/shuber"
},
{
"name": "Hugo Chinchilla Carbonell",
"email": "hugo@bulma.net",
"homepage": "https://github.com/hugochinchilla"
},
{
"name": "Robert Hamstar",
"email": "hamstar@telescum.co.nz",
"homepage": "https://github.com/hamstar"
},
{
"name": "Chris Duncan",
"email": "VEQRYN@hotmail.com",
"homepage": "https://github.com/veqryn"
}
],
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "4.3.*"
},
"autoload": {
"files": ["curl.php"]
"psr-0": {
"veqryn\\Curl": "lib/"
}
}
}
5 changes: 0 additions & 5 deletions curl.php

This file was deleted.

82 changes: 0 additions & 82 deletions lib/curl_exception.php

This file was deleted.

Loading