<?php
//リンク先のスクリーンショットを撮影する関数
function screenshot($url){
// キャプチャしたいWebページのURL
$url = 'https://appmedia.jp/fategrandorder';
// キャプチャするイメージの保存先
$outputImagePath = 'C:/Users/uc100/Programing/xampp/htdocs/codingspace/extention1/screenshot.png';
// wkhtmltoimageコマンドを組み立て
$command = "C:/Users/uc100/Programing/wkhtmltopdf/bin/wkhtmltoimage \"$url\" \"$outputImagePath\"";
// コマンドを実行
exec($command, $output, $returnCode);
if ($returnCode === 0) {
echo "Screenshot saved.";
} else {
echo "error";
}
}
?>
error statement
Loading page (1/2)
Warning: Failed to load https://appmedia.jp/wp-content/themes/appmedia/lib/fategrandorder/images/img/fgo_checker_bg0.jpg (ignore)
Rendering (2/2)
Warning: Received createRequest signal on a disposed ResourceObject's NetworkAccessManager. This might be an indication of an iframe taking too long to load.
Done
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Uplording Saved image
I want to take a screenshot using wkhtml, but the saved image looks wrong. I am not sure how to solve this problem, so I would appreciate it if someone can help me figure it out.