Jump to content

PHP Get


Zunox

Recommended Posts

I've used this code on my script, but for some reason its giving me a bad result.

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]);
        }
    }  

This is how its coming out on my project site. Date, Size, Seeders, Leechers are not showing anything.

 

vTQE9DO.png

 

Any ideas why this happens? Also the word i used on search was "adobe".

Thank you

 

get.php

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.