我需要与Xenu应用程序一起检查我的www网站上的视图链接。
在我的网站上有HTML代码。
<img src="mysite/pictures.php?url=http://othersite.com/pic1.jpg">
<img src="mysite/pictures.php?url=http://othersite.com/pic2.jpg">
<img src="mysite/pictures.php?url=http://othersite.com/pic3.jpg">
但是Xenu无法检查图片是否存在。如何在pictures.php
中使用一些脚本?
例如,我需要检查参数url=http://othersite.com/pic1.jpg
中的链接是否是JPG图片。我无法更改HTML代码,因为它必须是常量。所以我必须用一些PHP脚本来完成。
你有很多方法可以做到这一点,我一直使用的最好的方法是简单HTML DOM:-
<?php
include(simple_html_dom);
$html=new simplehtmldom();
$html->file_get_html('http://exampl.com');
foreach($html->find(img)->src as $scr) {
echo=strplace('mysite/pictures.php?url=','',$scr);
}
?>