← Desenvolvimento

Buscar os links de um site!!

Lida 8075 vezes

Offline

kingless 
Membro
Mensagens 857 Gostos 0
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

Bem parece-me que ir buscar os links a um certo despertou muita curiosidade!!
Por isso vou mostrar os dois codigos que  criei  para fazer isso!!

Existem duas formas vou colocar aqui as duas que eu criei!!


Código: [Seleccione]

<?
$links['site'] = $_REQUEST['site'];
if(!empty($links['site'])) {
$links = file ($links['site']);
foreach ($links as $links['source']) {
$links['mostrar'] = explode('href="', $links['source']);
$links['explode'] = explode('"',$links['mostrar'][1]);
if(preg_match("/((http:\/\/))/i", $links['explode'][0])) echo $links['explode'][0]."<br>";
} } else { echo "Insira o site!!". $_SERVER['PHP_SELF']."?site=http://wwww.site-quer.com"; exit(0); }
?>




Código: [Seleccione]

<?
if(!empty($_GET['site'])) {
header("Content-Type: text/plain");
$a=@file_get_contents($_GET['site']);
if(!empty($a)){
$b=explode('href="',$a);
foreach($b as $c){
$d=explode('"',$c);
if(preg_match("/((http:\/\/|https:\/\/|ftp:\/\/).+)/i",$d[0])){
echo $d[0]."\n";
} } } }
?>


Para testar os dois codigos e gravar num ficheiro links.php ou nome que voce quiser e entrar no site assim:

http://www.seu-site.com/links.php?site=http://www.site-para-ver-os-links.com

Exemplo:

http://www.madenet.info/links.php?site=http://mais-trafego.info/comunidade/index.php
 :wink:

Ps: Codigo do "tugabot" usado no pesquisador webtuga.
Offline

kingless 
Membro
Mensagens 857 Gostos 0
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

Os dois codigos fazem a mesma coisa, a unica diferença é que o  1º codigo não repete os mesmos links.
Offline

cenourinha 
Elite
Mensagens 4094 Gostos 21
Troféus totais: 34
Trófeus: (Ver todos)
Mobile User Apple User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4

Muito bom!
Offline

asturmas 
Administrador
Mensagens 19734 Gostos 50
Feedback +2

Troféus totais: 39
Trófeus: (Ver todos)
Mobile User Windows User Super Combination Combination Topic Starter 100 Poll Votes 50 Poll Votes 10 Poll Votes Poll Voter Poll Starter

interesante
tks
Offline

dark_devil 
Membro
Mensagens 13 Gostos 0
Troféus totais: 21
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Level 4 Level 3 Level 2 Level 1 10 Posts First Post Karma

gostei muito desses codigos, estao interresantes

 =D&gt;
Offline

MarKo 
Administrador
Mensagens 4610 Gostos 10
Feedback +1

Troféus totais: 37
Trófeus: (Ver todos)
Level 6 Windows User Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes Poll Voter 10 Polls Poll Starter

Assim o "tugabot" vai ser sucesso.
Offline

asturmas 
Administrador
Mensagens 19734 Gostos 50
Feedback +2

Troféus totais: 39
Trófeus: (Ver todos)
Mobile User Windows User Super Combination Combination Topic Starter 100 Poll Votes 50 Poll Votes 10 Poll Votes Poll Voter Poll Starter

mto sucesso..
Offline

swing 
Membro
Mensagens 3126 Gostos 41
Feedback +13

Troféus totais: 32
Trófeus: (Ver todos)
Avatar Level 6 Linux User Mobile User Windows User Super Combination Combination Topic Starter Poll Voter Level 5

interessante...
Offline

kingless 
Membro
Mensagens 857 Gostos 0
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

Novo codigo (Codigo é Enorme), não posso mostrar porque este codigo está ligado directamente ao "tugabot".

Mais têm aqui um exemplo:

http://madenet.info/link.php?site=http://www.mais-trafego.com/comunidade/index.php

Este codigo mostra todos links mesmo, sem tirar nem por mais um!!

 :)
Offline

asturmas 
Administrador
Mensagens 19734 Gostos 50
Feedback +2

Troféus totais: 39
Trófeus: (Ver todos)
Mobile User Windows User Super Combination Combination Topic Starter 100 Poll Votes 50 Poll Votes 10 Poll Votes Poll Voter Poll Starter

esse e ke e bom..
Offline

kingless 
Membro
Mensagens 857 Gostos 0
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

Criei mais uma forma lols mas é a mesma coisa que esse que ta ai em cima!!

Código: [Seleccione]

<?
header("User-Agent: Tugabot v1.0 - www.webtuga.com");
        header("Content-Type: text/plain");
function urlfilter($url){
if (substr($url,0,1) == '"' or substr($url,0,1) == "'") {
$url=substr($url,1,strlen($url)-1);
}
if (substr($url,strlen($url)-1,1) == '"' or substr($url,strlen($url)-1,1) == "'") {
$url=substr($url,0,strlen($url)-1);
}
return $url;
}

$ee=$_GET['site'];
$a=explode("href=",file_get_contents($_GET['site']));
unset($a[0]);
foreach($a as $b){
$c=explode('>',$b);
$d=explode(chr(32),$c[0]);
if (sizeof($d)-1>0){
$e=urlfilter($d[0]);
} else {
$e=urlfilter($c[0]);
}
if ($e = @explode("\n",$e)){$e=$e[0];}
if (@!eregi('javascript',$e)){
$f=parse_url($ee);
if (substr($e,0,7) != 'http://' && substr($e,0,8) != 'https://' && substr($e,0,6) != 'ftp://' && $f['scheme'] == 'http'){ if (substr($e,0,1) != '/') { $e="/$e";}echo 'http://'.$f['host']."$e\n"; }
elseif (substr($e,0,7) != 'http://' && substr($e,0,8) != 'https://' && substr($e,0,6) != 'ftp://' && $f['scheme'] == 'https'){ if (substr($e,0,1) != '/') { $e="/$e";}echo 'https://'.$f['host']."$e\n"; }
elseif (substr($e,0,7) != 'http://' && substr($e,0,8) != 'https://' && substr($e,0,6) != 'ftp://' && $f['scheme'] == 'ftp'){ if (substr($e,0,1) != '/') { $e="/$e";}echo 'ftp://'.$f['host']."$e\n"; }
else { echo "$e\n"; }
}

}

$a=explode("HREF=",file_get_contents($ee));
unset($a[0]);
foreach($a as $b){
$c=explode('>',$b);
$d=explode(chr(32),$c[0]);
if (sizeof($d)-1>0){
$e=urlfilter($d[0]);
} else {
$e=urlfilter($c[0]);
}
if ($e = @explode("\n",$e)){$e=$e[0];}
if (@!eregi('javascript',$e)){
$f=parse_url($ee);
if (substr($e,0,7) != 'http://' && substr($e,0,8) != 'https://' && substr($e,0,6) != 'ftp://' && $f['scheme'] == 'http'){ if (substr($e,0,1) != '/') { $e="/$e";}echo 'http://'.$f['host']."$e\n"; }
elseif (substr($e,0,7) != 'http://' && substr($e,0,8) != 'https://' && substr($e,0,6) != 'ftp://' && $f['scheme'] == 'https'){ if (substr($e,0,1) != '/') { $e="/$e";}echo 'https://'.$f['host']."$e\n"; }
elseif (substr($e,0,7) != 'http://' && substr($e,0,8) != 'https://' && substr($e,0,6) != 'ftp://' && $f['scheme'] == 'ftp'){ if (substr($e,0,1) != '/') { $e="/$e";}echo 'ftp://'.$f['host']."$e\n"; }
else { echo "$e\n"; }
}

}

?>


Exemplo:
http://81.84.94.78/tb.php?http://www.mais-trafego.info

Eu me admiro lools
 :D  :wink:
Offline

kingless 
Membro
Mensagens 857 Gostos 0
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

Mais um codigo lool, eu adoro php!!  :)

Código: [Seleccione]

<?
header("Content-Type: text/plain");
$QST = $_SERVER['QUERY_STRING'];
if(empty($QST) OR !preg_match('/^(http|https|ftp):\/\/((?:[-\w\d]*\.?)+)\/?([-%_\.\/\w\d\\\\]*)(?:\?(.+))?$/i', $QST)) {
$SITE = "http://www.site.com";
exit("Insira o site!! <body bgcolor=#a0a0a0><b>http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?$SITE</b></body>"); }
$fgc = file_get_contents($QST);
preg_match_all('/(href=\'|href=")(.*?)("|\')(.*?>)/i', $fgc, $tugabot);
foreach($tugabot[2] as $ok) {
if(preg_match("/^(http|https):\/\//i", $ok)) {
echo $ok."\n ";}
if(!preg_match("/^(http|https|ftp):\/\//i", $ok)) {
if(preg_match("/\/+$/i", $QST)) {
preg_match("/^(http:\/\/)?([^\/]+)/i", "$QST", $matches);
preg_match("/([^\/]*$)/i", "$ok", $match);
echo $matches[0]."/".$match[0]."\n ";
}elseif(preg_match("/([^\/])?([.*?]*)$/i", $QST) && addslashes($ok) == TRUE) {
preg_match("/^(http:\/\/)?([^\/]+)/i", "$QST", $matches);
preg_match('/([-%_\.\/\w\d\\\\]*)(?:\?(.+))?$/i', "$ok", $tb);
if(substr($tb[0],0,1) === "/") {
echo $matches[0].$tb[0]."\n ";
} if(substr($tb[0],0,1) !== "/") {
$td = "/".$tb[0];
echo $matches[0].$td."\n ";
} }  } }
?>


Exemplo:
http://madenet.info/link.php?site=http://www.mais-trafego.info

Acho que ja sei programar em php  8)  Criei 4 ou 5 codigos diferentes que fazem exactamente a mesma coisa!!  :wink:
Offline

MarKo 
Administrador
Mensagens 4610 Gostos 10
Feedback +1

Troféus totais: 37
Trófeus: (Ver todos)
Level 6 Windows User Super Combination Combination Topic Starter 50 Poll Votes 10 Poll Votes Poll Voter 10 Polls Poll Starter

Eu olho prái e vejo chinês, mas se isso funciona, parabens! Porque deve dar muito trabalho.
Offline

asturmas 
Administrador
Mensagens 19734 Gostos 50
Feedback +2

Troféus totais: 39
Trófeus: (Ver todos)
Mobile User Windows User Super Combination Combination Topic Starter 100 Poll Votes 50 Poll Votes 10 Poll Votes Poll Voter Poll Starter

n sei pk faxes coisas ke sao a mesma coisa ke a anterior lol
Offline

kingless 
Membro
Mensagens 857 Gostos 0
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

Porque ajuda a melhorar o meu php, e não da trabalho nenhum  :)