웹 캡처 및 변환 도구

Perl의 고급 스크린 샷 기능

펄 API

의 고급 기능을 사용하십시오 GrabzIt은 Perl API입니다 에 int기존 스크린 샷의 상태를 확인하거나 스크린 샷을 캡처 할 때 GrabzIt에서 사용하는 쿠키를 사용자 정의하는 등의 애플리케이션과 밀접한 관계를 유지하십시오.

스크린 샷 상태

앱에서 스크린 샷 상태를 확인해야 할 수도 있습니다. 스크린 샷이 준비되어 있는지 확인하거나 아직 캐시되어 다운로드 할 수 있는지 확인해야합니다.

$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");

$status = $grabzIt.GetStatus(screenShotId);

if ($status->getProcessing())
{
    # screenshot has not yet been processed
}

if ($status->getCached())
{
    # screenshot is still cached by GrabzIt
}

if ($status->getExpired())
{
    # screenshot is no longer on GrabzIt
    # Perhaps output status message?
    die $status->getMessage();
}

Cookies

웹 사이트에서 일부 기능을 표시하거나 숨기려면 쿠키를 설정해야 할 수도 있습니다. GrabzIt의 쿠키 방법을 사용하면 아래와 같이 할 수 있습니다.

$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");

# gets an array of cookies for google.com
@cookies = @{$grabzIt->GetCookies("google.com")};

foreach $cookie (@cookies)
{
    print $cookie->getName();
}

# sets a cookie for the google.com domain
$grabzIt->SetCookie("MyCookie", "google.com", "Any Value You Like");

# deletes the previously set cookie
$grabzIt->DeleteCookie("MyCookie", "google.com");

GrabzIt 쿠키를 설정, 읽기 및 삭제할 때의 모든 옵션에 대해서는 클라이언트 문서.

다운로드하지 않고 캡처 표시

권장되는 캡처는 사용하기 전에 웹 서버에 다운로드됩니다. 웹 서버에 먼저 다운로드하지 않고도 사용자의 브라우저에 모든 유형의 캡처를 표시 할 수 있습니다.

이렇게하려면 캡처가 완료된 후 캡처 한 바이트를 보낼 수 있습니다. SaveTo 방법 응답과 함께 올바른 마임 유형.

$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");

$grabzIt->URLToImage("https://www.tesla.com");
$capture = $grabzIt->SaveTo();

print "Content-type: image/jpeg\n\n";
print $capture;

캡처 출력의 예 intoa 웹 페이지는 위의 URLToImage 메소드를 사용하지만 모든 변환 메소드와 함께 작동합니다.