I am fairly new to PHP so please bear with me 🙂
What I am trying to do if place URL’s into a text area, then pull in the meta data for each.
I have made the script, but when I place more then one URL into the text area it only returns data for the last URL entered, I thought maybe you guys can help me 🙂
<form method="POST">
<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']));
foreach ($TAarray as $key => &$line) { $line = trim($line); }
// get the meta data for each url
$tags = get_meta_tags($line);
unset($tags["content-type"]);
unset($tags["page-type"]);
unset($tags["page-topic"]);
unset($tags["audience"]);
unset($tags["content-language"]);
echo '<tr>';
foreach ($tags as $meta)
{
echo '<td>' . $meta . '</td>';
}
echo '</tr>';
?>
The closing } after where you use trim on the line means that the foreach ends and only the last line is available after the loop for the other operations. Just move that bracket to the end.