From 23c01d2229d36476b2107261ea06efc6df65a970 Mon Sep 17 00:00:00 2001 From: Nijiko Yonskai Date: Mon, 21 Oct 2013 02:26:33 -0700 Subject: [PATCH 1/2] Update README.md --- README.md | 57 +++++++++---------------------------------------------- 1 file changed, 9 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 869f8e8..62316f5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ -Unirest-PHP -============================================ +# Unirest for PHP -Unirest is a set of lightweight HTTP libraries available in PHP, Ruby, Python, Java, Objective-C. +Unirest is a set of lightweight HTTP libraries available in multiple languages. Documentation ------------------- @@ -83,52 +82,14 @@ Unirest::patch($url, $headers = array(), $body = NULL); Unirest::delete($url, $headers = array()); ``` -`url` -Endpoint, address, or uri to be acted upon and requested information from. - -`headers` -Request Headers as associative array or object - -`body` -Request Body associative array or object +- `url` - Endpoint, address, or uri to be acted upon and requested information from. +- `headers` - Request Headers as associative array or object +- `body` - Request Body associative array or object ### Response Reference Upon recieving a response Unirest returns the result in the form of an Object, this object should always have the same keys for each language regarding to the response details. -`code` -HTTP Response Status Code (Example `200`) - -`headers` -HTTP Response Headers - -`body` -Parsed response body where applicable, for example JSON responses are parsed to Objects / Associative Arrays. - -`raw_body` -Un-parsed response body - -License ---------------- - -The MIT License - -Copyright (c) 2013 Mashape (http://mashape.com) - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +- `code` - HTTP Response Status Code (Example `200`) +- `headers` - HTTP Response Headers +- `body` - Parsed response body where applicable, for example JSON responses are parsed to Objects / Associative Arrays. +- `raw_body` - Un-parsed response body From 0701ed4896e3e47643dfc3fbb93a97780cde8978 Mon Sep 17 00:00:00 2001 From: Nijiko Yonskai Date: Mon, 21 Oct 2013 02:35:09 -0700 Subject: [PATCH 2/2] Update README.md --- README.md | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 62316f5..d3c0b3d 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,14 @@ Unirest is a set of lightweight HTTP libraries available in multiple languages. -Documentation -------------------- - -### Installing -Download the PHP library from Github, and require in your script like so: +## Installing +Download the `PHP` library from Github, and require in your script like so: ```php require_once './lib/Unirest.php'; ``` -#### Using Composer +### Using Composer [Composer](http://getcomposer.org/) is a package manager for PHP. @@ -37,7 +34,7 @@ Include the library in your project with: require 'vendor/autoload.php'; ```` -### Creating Request +## Creating Request So you're probably wondering how using Unirest makes creating requests in PHP easier, let's look at a working example: ```php @@ -49,7 +46,7 @@ $response = Unirest::post("http://httpbin.org/post", array( "Accept" => "applica ); ``` -### File Uploads +## File Uploads To upload files in a multipart form representation simply place an @ symbol before the path: ```php @@ -60,7 +57,7 @@ $response = Unirest::post("http://httpbin.org/post", array( "Accept" => "applica ); ``` -### Custom Entity Body +## Custom Entity Body Sending a custom body such as a JSON Object rather than a string or form style parameters we utilize json_encode for the body: ```php $response = Unirest::post("http://httpbin.org/post", array( "Accept" => "application/json" ), @@ -73,7 +70,7 @@ $response = Unirest::post("http://httpbin.org/post", array( "Accept" => "applica ); ``` -### Request Reference +# Request ```php Unirest::get($url, $headers = array()); Unirest::post($url, $headers = array(), $body = NULL); @@ -86,7 +83,7 @@ Unirest::delete($url, $headers = array()); - `headers` - Request Headers as associative array or object - `body` - Request Body associative array or object -### Response Reference +# Response Upon recieving a response Unirest returns the result in the form of an Object, this object should always have the same keys for each language regarding to the response details. - `code` - HTTP Response Status Code (Example `200`)