PHP code example of fenzland / http
1. Go to this page and download the library: Download fenzland/http library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fenzland / http example snippets
HTTP::scheme('http')->host('example.org')->port(80)->query('/example/')->headers([ 'key'=>'value', ])->method('GET')->version('1.1')->send();
HTTP::withScheme('http')->withHost('example.org')->withPort(80)->withQuery('/example/')->withHeaders([ 'key'=>'value', ])->withMethod('GET')->withVersion('1.1')->send();
HTTP::url('http://example.org/example/?key=value')->get();
HTTP::url('http://example.org/example/?key=value')->head();
HTTP::url('http://example.org/example/?key=value')->options();
HTTP::url('http://example.org/example/?key=value')->delete();
HTTP::url('http://example.org/example/?key=value')->post( 'id=1&name=Fenz' );
HTTP::url('http://example.org/example/?key=value')->put( 'id=1&name=Fenz' );
HTTP::url('http://example.org/example/?key=value')->patch( 'id=1&name=Fenz' );