function to get all of the pages without repeating connections

Source: Internet
Author: User
Tags array count split
Functions | page | repeat
Because I need to do a function,implement get page connection put into arrayIn
Train of thought: 1, get static + without parameter:
HTM HTML asp php jsp CGI
A, including absolute path processing: direct access
Preg_match_all ()?
b, which contains the relative path, the path gets the processing parameters:
Depending on the situation (. Or.. ) processing to get an absolute path
2, get the parameter:
3, after filtering: selected some can read the suffix such as asp,php,html, etc.
The connection is repeated for deletion.
4, run code directly on the laggards forum» website Building Column
The first page of the connection is taken down to the array $e, $e[o][0] is the first connection; $e[o][1] is the 2nd
  
  
Code:
?
$e=clinchgeturl ("http://im286.com/forumdisplay.php?fid=1");
  
Var_dump ($e);
function Clinchgeturl ($url)
{
  
$url= "http://127.0.0.1/1.htm";
$rootpath= "http://fsrootpathfsfsf/yyyyyy/";
Var_dump ($RRR);
if (eregi) (' (.) *[\.] (.) * ', $url)) {
$roopath=split ("\/", $url);
$rootpath= "http://". $roopath[2]. " /";
$nnn=count ($roopath) -1;for ($yu=3;$yu<$nnn;$yu++) {$rootpath.=$roopath[$yu]. " /";}
Var_dump ($rootpath); http:, ', 127.0.0.1,xnml,index.php
}
Else{$rootpath=$url;//var_dump ($rootpath);
}
if (Isset ($url)) {
echo "$url has the following walks to connect:<br>";
$fcontents = file ($url);
while (list (, $line) =each ($fcontents)) {
while (Eregi (href[[:space:]]*=[[:space:]]*)? [ [: Alnum:]:@/._-]+[\?]? [^\ "]*"] ", $line,$regs)") {
$REGS[1] = eregi_replace (' (href[[:space:]]*=[[:space:]]*\ "?) ([[: alnum:]:@/._-]+) (\ "?) '," \\2 ", $regs[1]);
$REGS[1] = eregi_replace (' (href[[:space:]]*=[[:space:]]*[\ "]?) ([: Alnum:]:@/._-]+[\?]? [^\ "]*" (\.*) [^\] \/]* ([\ "]?) '," \\2 ", $regs[1]);
  
if (!eregi (' ^http:\/\/', $regs[1])) {
  
if (eregi (' ^\.\. ', $regs[1])) {
$roopath=eregi_replace (' (http:\/\/)? ( [[: alnum:]:@/._-]+) [[: alnum:]+] (\.*) [[: alnum:]+] ', "http:\/\/\\2", $url);
  
$roopath=split ("\/", $rootpath);
$rootpath= "http://". $roopath[2]. " /";
echo "This is fundamental d:". \ n ";
$nnn=count ($roopath) -1;for ($yu=3;$yu<$nnn;$yu++) {$rootpath.=$roopath[$yu]. " /";}
Var_dump ($rootpath);
if (eregi (' ^\.\.[ \/[:alnum:]] ', $regs[1 ') {
echo "This is. /directory/: "." \ n ";
$regs[1]= ". /xx/xxxxxx.xx ";
$rr=split ("\/", $regs[1]);
For ($oooi=1;$oooi<count ($RR); $oooi++)
$RRR=$REGS[1];
{$rrr.= "/". $rr[$oooi];
$rrr = Eregi_replace ("^[\.") [\.] [\/] ",", $rrr); //}
  
$regs[1]=$rootpath.$rrr;
  
  
}
  
  
}else{
if (eregi (' ^[[:alnum:]] ', $regs[1])) {$regs[1]=$rootpath.$regs[1];}
  
else{$regs[1] = eregi_replace ("^[\/]", ', $regs[1]); $regs[1]=$rootpath.$regs[1];
  
}
  
  
}
  
  
  
  
  
$line = $regs[2];
if (eregi) (' (.) *[\.] (htm|shtm|html|asp|aspx|php|jsp|cgi) (.) * ', $regs[1]) {
$OUT[0][]=$REGS[1]; }
}
}
}for ($ouou=0;$ouou<count) ($out[0); $ouou++)
{
if ($out[0][$ouou]==$out[0][$ouou+1]) {
$sameurlsum=1;
echo "Sameurlsum=1:";
For ($sameurl=1;$sameurl<count ($out[0]); $sameurl++) {
if ($out[0][$ouou+$sameurl]==$out[0][$ouou+$sameurl+1]) {$sameurlsum++;}
Else{break;}
}
  
  
For ($p=$ouou;$p<count ($out[0]); $p++)
{$out[0][$p]=$out[0][$p+$sameurlsum];}
}
}
  
  
$i=0;
while ($out[0][++$i]) {
Echo $root.$out[0][$i]. " \ r \ n ";
$outed[0][$i]=$out[0][$i];
  
}
Unset ($out);
$out=$outed; return $out;
}
?>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.