Skip to content

Latest commit

 

History

History
22 lines (15 loc) · 473 Bytes

http.md

File metadata and controls

22 lines (15 loc) · 473 Bytes

HTTP resource

Creating an HTTP resource is as simple as passing a URL:

<?php
use ZeroConfig\Cli\Reader\HttpResource;

$resource = new HttpResource('https://httpbin.org/get');

foreach ($resource as $line) {
    echo $line;
}

As with the other resources, the HTTP resource can also function as a factory for itself. Note that it will then repeat HTTP requests, as the data is not kept in memory.

Further reading

See other input resources.