public static function writeRequest(api\AVRSAPI $api, $prefix = null) { if (($request = $api->getRequest()) === false) { return; } if (!isset($prefix)) { $prefix = date(self::$prefixFormat); } $fh = fopen(__DIR__ . '/' . $prefix . 'request.txt', 'w'); fwrite($fh, $request); fclose($fh); $fh = fopen(__DIR__ . '/' . $prefix . 'payload.json', 'w'); fwrite($fh, json_encode($api->getPayload())); fclose($fh); }