定制 techulus/capture 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

techulus/capture

Composer 安装命令:

composer require techulus/capture

包简介

Official PHP SDK for Capture (capture.page). Capture screenshots, generate PDFs, extract content and metadata from web pages.

README 文档

README

Official PHP SDK for Capture - Screenshot and content extraction API.

Installation

composer require techulus/capture

Quick Start

use Techulus\Capture\Capture;

$client = new Capture('your-api-key', 'your-api-secret');

$imageUrl = $client->buildImageUrl('https://example.com');
echo $imageUrl;

Features

  • Screenshot Capture: Capture full-page or viewport screenshots as PNG/JPG
  • PDF Generation: Convert web pages to PDF documents
  • Content Extraction: Extract HTML and text content from web pages
  • Metadata Extraction: Get page metadata (title, description, og tags, etc.)
  • Animated GIFs: Create animated GIFs of page interactions
  • Zero Dependencies: Uses only PHP built-in extensions (curl, json)

Usage

Initialize the Client

use Techulus\Capture\Capture;

$client = new Capture('your-api-key', 'your-api-secret');

// Use edge endpoint for faster response times
$client = new Capture('your-api-key', 'your-api-secret', ['useEdge' => true]);

Building URLs

Image Capture

$imageUrl = $client->buildImageUrl('https://example.com');

$imageUrl = $client->buildImageUrl('https://example.com', [
    'full' => true,
    'delay' => 2,
    'vw' => 1920,
    'vh' => 1080,
]);

PDF Capture

$pdfUrl = $client->buildPdfUrl('https://example.com');

$pdfUrl = $client->buildPdfUrl('https://example.com', [
    'format' => 'A4',
    'landscape' => true,
]);

Content Extraction

$contentUrl = $client->buildContentUrl('https://example.com');

Metadata Extraction

$metadataUrl = $client->buildMetadataUrl('https://example.com');

Animated GIF

$animatedUrl = $client->buildAnimatedUrl('https://example.com');

Fetching Data

Fetch Image

$imageData = $client->fetchImage('https://example.com');
file_put_contents('screenshot.png', $imageData);

Fetch PDF

$pdfData = $client->fetchPdf('https://example.com', ['full' => true]);
file_put_contents('page.pdf', $pdfData);

Fetch Content

$content = $client->fetchContent('https://example.com');
echo $content['html'];
echo $content['textContent'];
echo $content['markdown'];

Fetch Metadata

$metadata = $client->fetchMetadata('https://example.com');
print_r($metadata['metadata']);

Fetch Animated GIF

$gifData = $client->fetchAnimated('https://example.com');
file_put_contents('animation.gif', $gifData);

Configuration Options

Constructor Options

  • useEdge (bool): Use edge.capture.page instead of cdn.capture.page for faster response times
  • timeout (int): cURL timeout in seconds. Defaults to 30

API Endpoints

The SDK supports two base URLs:

  • CDN: https://cdn.capture.page (default)
  • Edge: https://edge.capture.page (when useEdge is true)

License

MIT

Links

Support

For support, please visit capture.page or open an issue on GitHub.

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 9
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固