0

我正在尝试获取在文本区域中输入的 url 的元标记,这有什么问题?

另外,我如何将元描述来自的 URL 与描述放在一起?

<form method="get">
<textarea name="TAData">
</textarea>
<input type="submit" value="submit"/>
</form>

<div id="checkboxes">
<input type="checkbox" name="vehicle" value="PR" /> Show me the PR<br />
<input type="checkbox" name="vehicle" value="KW Tag" /> Show me the KW tag<br />
<input type="checkbox" name="vehicle" value="Title Tag" /> Show me the Title tag<br />
</div>
<div id="checkboxes">
<input type="checkbox" name="vehicle" value="1stH1" /> Show me the 1st H1<br />
<input type="checkbox" name="vehicle" value="2ndH1" /> Show me the 2nd H1 tag<br />
<input type="checkbox" name="vehicle" value="SeedKW" /> Show me Seed KW's<br />
</div>

<div id="nofloat"></div>

<?php

//make the array 
$TAarray = explode("\n", strip_tags($_POST['TAData'])); 

var_dump($TAarray);

//loop through the array 
foreach ($TAarray as $line) { 


   $line = htmlspecialchars(trim($line)); 
}      

    foreach ($TAarray as $url) {

            // get the meta data for each url
            $tags = get_meta_tags($url);

unset($tags["content-type"]);
unset($tags["page-type"]);
unset($tags["page-topic"]);
unset($tags["audience"]);

                echo '<tr>';
                foreach ($tags['description'] as $meta)         
            {
                        echo '<td>' . $meta . '</td>';
                }
                echo '</tr>';
        }
?>

另外,有没有办法只包含元描述?

4

1 回答 1

1

1)您的表单被声明为 GET,但您正在从 $_POST 字段中读取值。

2)如果你只想提取“描述”元值,你不需要对标签进行迭代,你可以使用:

$description = $tags["description"]
于 2012-04-10T16:24:13.527 回答