1. Go to this page and download the library: Download innmind/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/ */
innmind / http example snippets
use Innmind\Http\Factory\ServerRequest\ServerRequestFactory;
$request = ServerRequestFactory::default()();
use Innmind\Http\{
Response,
Response\StatusCode,
ProtocolVersion,
Headers,
Header,
Header\ContentType,
Header\ContentTypeValue,
ResponseSender,
};
use Innmind\Filesystem\File\Content;
use Innmind\TimeContinuum\Earth\Clock;
$response = Response::of(
StatusCode::ok,
ProtocolVersion::v11,
Headers::of(
ContentType::of('application', 'json'),
),
Content\Lines::ofContent('{"some": "data"}'),
);
(new ResponseSender(new Clock))($response);
use Innmind\Http\{
Request,
Method,
Content\Multipart,
Header\ContentType,
Header\ContentType\Boundary,
Headers,
ProtocolVersion,
};
use Innmind\Filesystem\{
File\File,
File\Content,
};
use Innmind\Url\Url;
$boundary = Boundary::uuid();
$request = Request::of(
Url::of('http://some-server.com/')
Method::post,
ProtocolVersion::v11,
Headers::of(ContentType::of('multipart', 'form-data', $boundary)),
Multipart::boundary($boundary)
->with('some[key]', 'some value')
->withFile('some[file]', File::named(
'whatever.txt',
Content::ofString(' can be any file content'),
)),
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.