Beispiel #1
0
$message = '';
if (count($_POST) > 0) {
    if (isset($_POST["delete"]) && $_POST["delete"] == 1) {
        $files = glob('results/*');
        foreach ($files as $file) {
            if (is_file($file)) {
                unlink($file);
            }
        }
    } else {
        $url = $_POST["url"];
        $format = $_POST["format"];
        try {
            $grabzIt = new GrabzItClient($grabzItApplicationKey, $grabzItApplicationSecret);
            if ($format == "pdf") {
                $grabzIt->SetPDFOptions($url);
            } else {
                $grabzIt->SetImageOptions($url);
            }
            $grabzIt->Save($grabzItHandlerUrl);
        } catch (Exception $e) {
            $message = $e->getMessage();
        }
    }
}
?>
<html>
<head>
<title>GrabzIt Demo</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
Beispiel #2
0
$message = '';
if (count($_POST) > 0) {
    if (isset($_POST["delete"]) && $_POST["delete"] == 1) {
        $files = glob('results/*');
        foreach ($files as $file) {
            if (is_file($file)) {
                unlink($file);
            }
        }
    } else {
        $url = $_POST["url"];
        $format = $_POST["format"];
        try {
            $grabzIt = new GrabzItClient($grabzItApplicationKey, $grabzItApplicationSecret);
            if ($format == "pdf") {
                $grabzIt->SetPDFOptions($url, null, null, -1);
            } else {
                if ($format == "gif") {
                    $grabzIt->SetAnimationOptions($url);
                } else {
                    $grabzIt->SetImageOptions($url, null, null, null);
                }
            }
            $grabzIt->Save($grabzItHandlerUrl);
        } catch (Exception $e) {
            $message = $e->getMessage();
        }
    }
}
?>
<html>