|
<?
$ 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 links: <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 the root 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 );/ |