<commit_before># CurlWrapper

Flexible wrapper class for PHP cURL extension (see [http://php.net/curl](http://php.net/curl) for more information about the libcurl extension for PHP)


## Installation

Click the `download` link above or `git clone git://github.com/Svyatov/CurlWrapper.git`


## Usage

### Initialization

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

	require_once 'CurlWrapper.php';
	try {
	    $curl = new CurlWrapper();
	} catch (CurlWrapperException $e) {
	    echo $e->getMessage();
	}
}


### Performing a Request

The CurlWrapper object supports 5 types of requests: HEAD, GET, POST, PUT, and DELETE. You must specify a url to request and optionally specify an associative array or string of variables to send along with it.

	$response = $curl->head($url, $params);
	$response = $curl->get($url, $params); # The CurlWrapper object will append the array of $params to the $url as a query string
	$response = $curl->post($url, $params);
	$response = $curl->put($url, $params);
	$response = $curl->delete($url, $params);

To use a custom request methods, you can call the `request` method:

	$response = $curl->request('ANY_CUSTOM_REQUEST_TYPE', $url, $params);

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

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

Examples:

	$response = $curl->get('google.com?q=test');

	# The CurlWrapper object will append '&some_variable=some_value' to the url
	$response = $curl->get('google.com?q=test', array('some_variable' => 'some_value'));
<commit_msg>Total refactoring, 70% of code was rewritten.<commit_after># CurlWrapper

Flexible wrapper class for PHP cURL extension (see [http://php.net/curl](http://php.net/curl) for more information about the libcurl extension for PHP)


## Installation

Click the `download` link above or `git clone git://github.com/Svyatov/CurlWrapper.git`


## Usage

### Initialization

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

	require_once 'CurlWrapper.php';

	try {
	    $curl = new CurlWrapper();
	} catch (CurlWrapperException $e) {
	    echo $e->getMessage();
	}


### Performing a Request

The CurlWrapper object supports 5 types of requests: HEAD, GET, POST, PUT, and DELETE. You must specify a url to request and optionally specify an associative array or string of variables to send along with it.

	$response = $curl->head($url, $params);
	$response = $curl->get($url, $params); # The CurlWrapper object will append the array of $params to the $url as a query string
	$response = $curl->post($url, $params);
	$response = $curl->put($url, $params);
	$response = $curl->delete($url, $params);

To use a custom request methods, you can call the `request` method:

	$response = $curl->request('ANY_CUSTOM_REQUEST_TYPE', $url, $params);

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

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

Examples:

	$response = $curl->get('google.com?q=test');

	# The CurlWrapper object will append '&some_variable=some_value' to the url
	$response = $curl->get('google.com?q=test', array('some_variable' => 'some_value'));

{'fraction_non_alphanumeric': 0.12946298984034832, 'fraction_numerical': 0.0011611030478955006, 'mean_word_length': 4.5941558441558445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7507956', 'n_tokens_mistral': 1099, 'n_tokens_neox': 1034, 'n_words': 380}