dev-master
9999999-dev https://github.com/sandeepshetty/wcurlA convenience wrapper around PHP's cURL library
MIT
The Requires
- php >=5.0.0
api curl http
A convenience wrapper around PHP's cURL library
A convenience wrapper around PHP's cURL library, (*1)
Create a composer.json
file if you don't already have one in your projects root directory and require wcurl:, (*2)
{ "require": { "sandeepshetty/wcurl": "dev-master" } }
Install Composer:, (*3)
$ curl -s http://getcomposer.org/installer | php
Run the install command:, (*4)
$ php composer.phar install
This will download wcurl into the vendor/sandeepshetty/wcurl
directory., (*5)
To learn more about Composer visit http://getcomposer.org/, (*6)
Download the latest version of wcurl:, (*7)
$ curl -L http://github.com/sandeepshetty/wcurl/tarball/master | tar xvz $ mv sandeepshetty-wcurl-* wcurl
string wcurl( string $method , string $url [, mixed $query [, mixed $payload [, array $request_headers [, array &$response_headers [, array $curl_opts ]]]]] ), (*8)
1, 'per_page'=>2)); // Basic POST request // Parameters you want to skip can be passed as NULL. For example, here the query parameter is passed as NULL. $body = wcurl('POST', 'http://duckduckgo.com/', NULL, array('q'=>'42', 'format'=>'json')); // POST request with a custom request header (Content-Type) and an overriden cURL opt (CURLOPT_USERAGENT) // Also passing in a variable ($response_headers) to get back the response headers $response_headers = array(); $response_body = wcurl ( 'POST', 'https://api.github.com/gists', NULL, stripslashes(json_encode(array('description'=>'test gist', 'public'=>true, 'files'=>array('42.txt'=>array('content'=>'The Answer to the Ultimate Question of Life, the Universe, and Everything'))))), array('Content-Type: application/json; charset=utf-8'), $response_headers, // This variable is filled with the response headers array(CURLOPT_USERAGENT=>'MY_APP_NAME') ); ?>
A convenience wrapper around PHP's cURL library
MIT
api curl http