kooroshekabir67
Member
من این تابع رو واسه سایتم نوشتم ولی خوب میخوام خانه هایی از آرایه که لینک ندارن یا لینک جاوااسکریپت هستش رو از داخلش حذف کنم ولی نمیدونم چرا درست کار نمیکنه
PHP:
<?php
function getLink($url)
{
$input = @file_get_contents($url) or die("Could not access file: $url");
$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
if(preg_match_all("/$regexp/siU", $input, $matches, PREG_SET_ORDER))
{
foreach($matches as $match)
{
if($match[2]!="" || !preg_match('/^javascript/',$match[2]))
{
unset($matches[0]);
}
}
}
foreach($matches as $match)
{
echo $match[2]."<br/>";
}
}
getLink("http://www.parsinic.com");