I've used this code on my script, but for some reason its giving me a good result.
This is the code i used:
Any ideas why this happens? Also the word i used on search was "adobe".
Thank you
This is the code i used:
PHP:
else if ($site==3) {
//$content=file_get_contents('data/tp2');
$content=httpGet('http://thepiratebay.se/search/'.urlencode($string).'/0/99/0');
preg_match_all('#<tr.*>(.+)</tr>#Us',$content,$m);
$array=array();
foreach ($m[1] as $k =>$v) {
if (strpos($v,'detLink')===false) {
continue;
}
preg_match_all('#<td.*>(.+)</td>#Us',$v,$m2);
$array[$k]=array();
$array[$k]['size']=0;
foreach ($m2[1] as $k2 =>$v2) {
switch ($k2) {
case 0:
$c=strip_tags($v2);
$array[$k]['category']=substr($c,0,strpos($c,'>')-1);
break;
case 2:
$d=trim(strip_tags($v2));
$array[$k]['date']=convertDate2($d);
break;
case 1:
preg_match('#<a href="([^"]+)".*>(.+)</a>#Us',$v2,$m3);
if (isset($m3[1])) {
$array[$k]['id']=$m3[1];
} else {
$array[$k]['id']='';
}
$name=trim(str_replace(' ',"\n",strip_tags($m3[2])));
$array[$k]['name']=$name;
break;
case 4:
@list($num,$base)=explode(' ',trim(strip_tags($v2)));
$array[$k]['size']=toB($num,$base);
break;
case 5:
$array[$k]['seeds']=trim(strip_tags($v2));
break;
case 6:
$array[$k]['peers']=trim(strip_tags($v2));
break;
}
}
if (empty($array[$k]['id']) || empty($array[$k]['category'])) {
unset($array[$k]);
}
}
Thank you
Last edited: