Ayuda con este code !

Iniciado por coding++, Octubre 23, 2011, 03:57:32 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Octubre 23, 2011, 03:57:32 PM Ultima modificación: Febrero 14, 2015, 08:23:28 AM por Expermicid
Código: php

<?php
@ set_time_limit ( 0 );
@ error_reporting ( 0 );
ini_set ( 'memory_limit' , '128M' );

if (isset ( $_POST['search']))
{
$thisdork = $_POST['dork'];
$frompage = intval ( $_POST['frompage']);
$topage = intval ( $_POST['ftopage']);
$item1 = ( $frompage - 1 )* 10 ;
$item2 = ( $topage - 1 )* 10 ;
$templinks = array();
$links = array();
$finalinks = array();
$gurl = str_replace ( ' ' , '+' , "http://www.google.com/search?q= $thisdork &start=" );
for ( $i = $item1 ; $i <= $item2 ; $i += 10 )
{
$thispage = connecturl ( $gurl . $i );
preg_match_all ( "/<h3 class=(.*?)><a href=\"(.*?)\" class=(.*?)>/" , $thispage , $templinks );
foreach ( $templinks as $thislink )
if ( validateurl ( $thislink ))
array_push ( $links , $thislink );
}
$linkscount = count ( $links );
}

function connecturl ( $url )
{
$ch = curl_init ();
curl_setopt ( $ch , CURLOPT_FOLLOWLOCATION , 0 );
curl_setopt ( $ch , CURLOPT_HEADER , 1 );
curl_setopt ( $ch , CURLOPT_URL , $url );
curl_setopt ( $ch , CURLOPT_RETURNTRANSFER , 1 );
curl_setopt ( $ch , CURLOPT_TIMEOUT , 30 );
$data = curl_exec ( $ch );
if( $data )
return $data ;
else
return 0 ;
}

function validateurl ( $url )
{
if ( preg_match ( '@^(?:http://)?(;^/;+)@i' , $url ))
return 1 ;
else
return 0 ;
}
?>

<html>
<head>
<title>Google Dork Finder</title>
</head>
<body>
<form method="POST" action=" <?php $_SERVER ; PHP_SELF ;; ?> ">
<p>Dork: <input type="text" name="dork" size="30"></p>
<p>Pages from <input type="text" name="frompage" size="5" value="1"> to <input type="text" name="topage" size="5" value="5"></p>
<p><input type="submit" value="Dork It!" name="search"><input type="reset" value="Reset" name="reset"></p>
<p>
<?php
if (isset ( $_POST['search'])) {
echo " $linkscount links found:" ;
echo '<p><textarea rows="30" name="linkslist" cols="100" readonly>' ;
foreach ( $links as $a )
echo $a . "\r\n" ;
echo '</textarea></p>' ; } ?>
</form>
</body>
</html>
?>


¿Qué esta mal que no lo hace conectar?