Complete guide to the official Screenshothis PHP SDK
Install with Composer
Initialize client
Capture your first screenshot
Exception Type | Status Code | When it occurs | How to handle |
---|---|---|---|
ForbiddenExceptionThrowable | 403 | API quota exceeded or invalid key | Check your quota and key validity |
InternalServerErrorThrowable | 500 | Server-side error | Retry with exponential backoff |
APIException | Various | General API errors | Check error message for details |
requestId
from error responses when contacting support.Performance optimization
cacheKey
parameterError handling
Security considerations
Memory management
Format | Use case | Pros | Cons |
---|---|---|---|
JPEG | General purpose, photos | Smaller file size, wide support | No transparency, lossy compression |
PNG | Screenshots with transparency | Lossless, transparency support | Larger file sizes |
WebP | Modern applications | Best compression, transparency | Limited older browser support |
Operations\BlockResource::Document
- HTML documentsOperations\BlockResource::Stylesheet
- CSS stylesheetsOperations\BlockResource::Image
- ImagesOperations\BlockResource::Media
- Audio/video mediaOperations\BlockResource::Font
- Web fontsOperations\BlockResource::Script
- JavaScript filesOperations\BlockResource::Xhr
- XMLHttpRequest callsOperations\BlockResource::Fetch
- Fetch API requests