Documentation Packages Support

Http Client ⋅ Logging

The LogHttpArchive interceptor allows logging all requests / responses including detailed timing information to an HTTP archive (HAR).

These log files can then be imported into the browsers developer tools or online tools like HTTP Archive Viewer or Google’s HAR Analyzer.

Be careful if your log files might contain sensitive information in URLs or headers if you submit these files to third parties like the linked services above.

use Amp\Http\Client\HttpClientBuilder;
use Amp\Http\Client\Interceptor\LogHttpArchive;

$httpClient = (new HttpClientBuilder)
    ->intercept(new LogHttpArchive('/tmp/http-client.har'))
    ->build();

$httpClient->request(...);

HAR Viewer Screenshot