我试图在没有复杂的php块的情况下同时检查多个URL的头响应。
<?php
$url = array("http://www.simplysup.co.uk/download/dl/trjsetup692.exe");
$headers = get_headers($url);
$response = substr($headers[0], 9, 3);
if ($response != "404") {
echo "PASS";
} else {
echo "FAIL";
}
?>
上面的代码一次检查一个URL。如何同时对多个URL执行相同的操作?当标题响应为404时,我还需要触发带有URL的电子邮件。非常感谢任何帮助。
答案 0 :(得分:0)
我认为这可以解决您的问题。
Dim newRow As DataRow = Nothing
For Each record As DataRow In ds.Tables(0).Rows
newRow = ds2.Tables(4).Rows.Add()
DataRow.Item("ProductName") = record.Item("ProductName").ToString
DataRow.Item("ProductNumber") = record.Item("ProductNumber").ToString
DataRow.Item("ProductDash") = record.Item("ProductDash").ToString
DataRow.Item("SerialNumber") = record.Item("SerialNumber").ToString
DataRow.Item("ProductRevision") = record.Item("ProductRevision").ToString
newRow = ds2.Tables(3).Rows.Add()
newRow.Item("Activity") = record.Item("Activity").ToString
newRow.Item("Condition") = record.Item("Condition").ToString
newRow.Item("Usage") = record.Item("Usage").ToString
Next