Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
<pre><?php
$txt = get_url();
$local = "www.your.site.com";
preg_match_all("#\<a.*href.*=.*['\"]??(.*)['\"\s].*\>(.*)\</a\>#isU",$txt,$urls);
foreach ($urls[1] as $key=>$url) {
if (strpos($url,"http:")===false||strpos($url,$local)!==false) $out['loc'][] = array($url,$urls[2][$key]);
else $out['ext'][] = array($url,$urls[2][$key]);
}
var_dump($out);
?>
preg_match_all('/\<a.+?href=([^\s>]*)[^\s>]/i', $html, $matches);
$arr_local = array("http://mysite.com/", "http://www.mysite.com/");
for($i = 0; $i < count($matches[1]); $i++){
$s = $matches[1][$i];
if($s[0] == '"') $s = substr($s, 1, -1);
if($s[0] == "'") $s = substr($s, 1, -1);
if($s[strlen($s) -1] == '"') $s = substr($s, 0, -2);
if($s[strlen($s) -1] == "'") $s = substr($s, 0, -2);
$bExternal = false;
do{
if(strtolower(substr($s, 0, 7)) != "http://") break;
$bBreak = false;
for($j = 0; $j < count($arr_local); $j++){
if(strtolower(substr($s, 0, strlen($arr_local[$j]) ) ) == $arr_local[$j]) break;
}
if($bBreak) break;
// External link (not secure)
// сдесь код по обработке внешней ссылки
$bExternal = true;
}while(false);
if($bExternal){
// External link
$arr_external[] = $s;
}else{
// Internal link
$arr_internal[] = $s;
}
}
<?php
$html=file_get_contents ('http://www.popsu.net');
$url='popsu.net';
$vnut=array();
$vnech=array();
preg_match_all('~<a[^<>]*href=[\'"]([^\'"]+)[\'"][^<>]*>(((?!</a).)*)</a>~si',$html, $matches);
foreach ($matches[1] as $val) {
if (!preg_match("~^[^=]+://~", $val) || preg_match("~^[^://]+://(www\.)?".$url."~i", $val)) { $vnut[]=$val; }
else $vnech[]=$val;
}
$vnut=array_unique ($vnut);
$vnech=array_unique ($vnech);
print_r ($vnut);
print_r ($vnech);
?>