diff --git a/README.md b/README.md index 23f2ecc30..4f198f71f 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Installation ------------ ### Install with Composer -If you're using [Composer](https://github.com/composer/composer) to manage +If you're using [Composer](http://getcomposer.org/) to manage dependencies, you can add Requests with it. ```sh diff --git a/docs/README.md b/docs/README.md index 8116963d6..8fa0e3ee1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -25,4 +25,4 @@ here are prose; you might also want to check out the [API documentation][]. [authentication]: authentication.md [authentication-custom]: authentication-custom.md [hooks]: hooks.md -[proxy]: proxy.md \ No newline at end of file +[proxy]: proxy.md diff --git a/docs/authentication-custom.md b/docs/authentication-custom.md index 213590fc0..e4f55854a 100644 --- a/docs/authentication-custom.md +++ b/docs/authentication-custom.md @@ -47,4 +47,4 @@ system documentation][hooks]. Previous: [Authenticating your request](authentication.md) -Next: [Requests through proxy](proxy.md) \ No newline at end of file +Next: [Requests through proxy](proxy.md) diff --git a/docs/authentication.md b/docs/authentication.md index 4070ff5fc..fd49391ef 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -10,7 +10,7 @@ A Basic authenticated call can be made like this: $options = array( 'auth' => new Requests_Auth_Basic(array('user', 'password')) ); -Requests::get('http://httpbin.org/basic-auth/user/password', array(), $options); +Requests::get('https://httpbin.org/basic-auth/user/password', array(), $options); ``` As Basic authentication is usually what you want when you specify a username @@ -20,18 +20,18 @@ and password, you can also just pass in an array as a shorthand: $options = array( 'auth' => array('user', 'password') ); -Requests::get('http://httpbin.org/basic-auth/user/password', array(), $options); +Requests::get('https://httpbin.org/basic-auth/user/password', array(), $options); ``` Note that `POST`/`PUT` requests take a `$data` parameter, so you need to pass that before `$options`: ```php -Requests::post('http://httpbin.org/basic-auth/user/password', array(), null, $options); +Requests::post('https://httpbin.org/basic-auth/user/password', array(), null, $options); ``` *** Previous: [Advanced usage](usage-advanced.md) -Next: [Custom authentification](authentication-custom.md) \ No newline at end of file +Next: [Custom authentification](authentication-custom.md) diff --git a/docs/goals.md b/docs/goals.md index f0fa02a85..2c42f5561 100644 --- a/docs/goals.md +++ b/docs/goals.md @@ -30,4 +30,4 @@ Goals *** -Next: [Why Requests Instead of X?](why-requests.md) \ No newline at end of file +Next: [Why Requests Instead of X?](why-requests.md) diff --git a/docs/hooks.md b/docs/hooks.md index 358309d97..b8fa427e8 100644 --- a/docs/hooks.md +++ b/docs/hooks.md @@ -49,7 +49,7 @@ Available Hooks Parameters: `string &$response, array &$info` - `$info` contains the associated array as defined in [curl-getinfo-returnvalues](http://php.net/manual/en/function.curl-getinfo.php#refsect1-function.curl-getinfo-returnvalues) + `$info` contains the associated array as defined in the return value for [curl_getinfo()](http://php.net/manual/en/function.curl-getinfo.php#refsect1-function.curl-getinfo-returnvalues). * **`fsockopen.before_request`** @@ -77,7 +77,8 @@ Available Hooks Parameters: `string &$response, array &$info` - `$info` contains the associated array as defined in [stream-get-meta-data-returnvalues](http://php.net/manual/en/function.stream-get-meta-data.php#refsect1-function.stream-get-meta-data-returnvalues) + `$info` contains the associated array as defined in the return value for [stream_get_meta_data()](http://php.net/manual/en/function.stream-get-meta-data.php#refsect1-function.stream-get-meta-data-returnvalues). + Registering Hooks @@ -87,16 +88,16 @@ Authentication guide][authentication-custom] instead. [authentication-custom]: authentication-custom.md -In order to register your own hooks, you need to instantiate `Requests_hooks` -and pass the object in via the 'hooks' option. +In order to register your own hooks, you need to instantiate `Requests_Hooks` +and pass the object in via the `'hooks'` option. ```php $hooks = new Requests_Hooks(); $hooks->register('requests.after_request', 'mycallback'); -$request = Requests::get('http://httpbin.org/get', array(), array('hooks' => $hooks)); +$request = Requests::get('https://httpbin.org/get', array(), array('hooks' => $hooks)); ``` *** -Previous: [Requests through proxy](proxy.md) \ No newline at end of file +Previous: [Requests through proxy](proxy.md) diff --git a/docs/proxy.md b/docs/proxy.md index 96878871d..31e2a725c 100644 --- a/docs/proxy.md +++ b/docs/proxy.md @@ -9,7 +9,7 @@ To make requests through an open proxy, specify the following options: $options = array( 'proxy' => '127.0.0.1:3128' ); -Requests::get('http://httpbin.org/ip', array(), $options); +Requests::get('https://httpbin.org/ip', array(), $options); ``` If your proxy needs you to authenticate, the option will become an array like @@ -19,11 +19,11 @@ in the following example: $options = array( 'proxy' => array( '127.0.0.1:3128', 'my_username', 'my_password' ) ); -Requests::get('http://httpbin.org/ip', array(), $options); +Requests::get('https://httpbin.org/ip', array(), $options); ``` *** Previous: [Custom authentification](authentication-custom.md) -Next: [Hooking system](hooks.md) \ No newline at end of file +Next: [Hooking system](hooks.md) diff --git a/docs/usage-advanced.md b/docs/usage-advanced.md index bf4ef3b6b..adfdda9a3 100644 --- a/docs/usage-advanced.md +++ b/docs/usage-advanced.md @@ -74,4 +74,4 @@ bugs in PHP for more information on Subject Alternate Name field. Previous: [Making a request](usage.md) -Next: [Authenticating your request](authentication.md) \ No newline at end of file +Next: [Authenticating your request](authentication.md) diff --git a/docs/usage.md b/docs/usage.md index 071b706cc..4a44d9afe 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -1,29 +1,13 @@ Usage ===== -Ready to go? Make sure you have Requests [installed][download] before attempting any of the +Ready to go? Make sure you have Requests [installed][download] and bootstrapped either the +Composer `autoload.php` file, the Requests autoload function or your autoloader, before attempting any of the steps in this guide. [download]: {{ '/download/' | prepend: site.baseurl }} -Loading Requests ----------------- -Before we can load Requests up, we'll need to make sure it's loaded. This is a -straight-forward two-step: - -```php -// First, include Requests -include('/path/to/library/Requests.php'); - -// Next, make sure Requests can load internal classes -Requests::register_autoloader(); -``` - -If you'd like to bring along your own autoloader, you can forget about this -completely. - - Make a GET Request ------------------ One of the most basic things you can do with HTTP is make a GET request. @@ -63,7 +47,7 @@ Make a POST Request Making a POST request is very similar to making a GET: ```php -$response = Requests::post('http://httpbin.org/post'); +$response = Requests::post('https://httpbin.org/post'); ``` You'll probably also want to pass in some data. You can pass in either a @@ -74,7 +58,7 @@ internally) as the third parameter (after the URL and headers): ```php $data = array('key1' => 'value1', 'key2' => 'value2'); -$response = Requests::post('http://httpbin.org/post', array(), $data); +$response = Requests::post('https://httpbin.org/post', array(), $data); var_dump($response->body); ``` @@ -96,7 +80,7 @@ This gives the output: "Host": "httpbin.org", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" }, - "url": "http://httpbin.org/post", + "url": "https://httpbin.org/post", "args": {}, "data": "" }" @@ -161,4 +145,4 @@ If a header isn't set, this will give `null`. You can also check with Previous: [Why should I use Requests instead of X?](why-requests.md) -Next: [Advanced usage](usage-advanced.md) \ No newline at end of file +Next: [Advanced usage](usage-advanced.md) diff --git a/docs/why-requests.md b/docs/why-requests.md index 341e51d47..1e66cc370 100644 --- a/docs/why-requests.md +++ b/docs/why-requests.md @@ -30,7 +30,7 @@ Why should I use Requests? 3. **Thoroughly tested** - Requests is [continuously integrated with Travis][travis] and test coverage + Requests is [continuously integrated with GH Actions][ghactions] and test coverage is [constantly monitored with CodeCov][codecov] to give you confidence in the library. We aim for test coverage **over 90%** at all times, and new features require new tests to go along with them. This ensures that you can @@ -61,7 +61,7 @@ Why should I use Requests? [codecov]: https://app.codecov.io/gh/WordPress/Requests/branch/master [hooking system]: hooks.md [requests_ssl]: https://github.com/WordPress/Requests/blob/master/library/Requests/SSL.php -[travis]: https://travis-ci.org/WordPress/Requests +[ghactions]: https://github.com/WordPress/Requests/actions [wpssl]: http://core.trac.wordpress.org/ticket/25007 @@ -81,7 +81,7 @@ instead of something else, in our opinion. projects indicates that cURL is available on roughly 90% of hosts, but that leaves 10% of hosts without it. -2. **cURL's interface sucks** +2. **cURL's interface is hard to work with** cURL's interface was designed for PHP 4, and hence uses resources with horrible functions such as `curl_setopt()`. Combined with that, it uses 229 @@ -176,4 +176,4 @@ instead of something else, in our opinion. Previous: [Goals](goals.md) -Next: [Making a request](usage.md) \ No newline at end of file +Next: [Making a request](usage.md)