1. Go to this page and download the library: Download slepic/http-transfer 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/ */
//create services
$storage = new ArrayStorage();
$observer = new HistoryObserver($storage);
//somewhere you send some requests
foreach ($requests as $request) {his
$delegate = $observer->observe($request);
try {
$response = $client->sendRequest($request);
} catch (\Exception $e) {
$delegate->error($e);
throw $e;
}
$delegate->success($response);
}
//and when u need it you can access transfer logs
foreach ($storage as $log) {
var_dump($log->getRequest());
var_dump($log->getResponse());
var_dump($log->getEndTime() - $log->getStartTime());
//...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.