Well I am still having issues figuring this engine out. I have tried to add a debug line to the $cli variable but, the file gets created but, it is empty. If someone could look at the code and see if I've made a simple error.
This file has been created as MySite.php and placed in the engines directory.
Code:
<?php
class MySiteEngine extends commonEngine
{
public $defaults = array( "public"=>false, "page_size"=>30, "cookies"=>"mysite.com|pass=XXX;uid=XXX" );
public $categories = array(
'all'=>'&category=0',
'720p'=>"&category=1",
'1080p'=>"&category=2",
'Remux'=>"&category=3",
'HD-DVD'=>"&category=11",
'HD-TV'=>"&category=15",
'Anime'=>"&category=5",
);
public function action($what,$cat,&$ret,$limit,$useGlobalCats)
{
$added = 0;
$url = '
http://mysite.com';
if($useGlobalCats)
$categories = array( 'all'=>'&category=0' );
else
$categories = &$this->categories;
if(!array_key_exists($cat,$categories))
$cat = $categories['all'];
else
$cat = $categories[$cat];
for($pg = 1; $pg<10; $pg++)
{
$cli = $this->fetch( $url.'/index.php?page=torrents&active='.$cat.'&search='.$what.'&&order=2&by=1&pages='.$pg );
file_put_contents("urlfile.txt", $cli, FILE_APPEND); //LOG CLI VAR
if( ($cli==false) ) break;
$res = preg_match_all('`<td align="center".*<img src="
http://mysite.com/style/bluehover/images/categories/.*" border="0" alt="(?P<cat>[^"]*)".*'.
'<a href="index.php\?page=torrent-details&id=(?P<id>[^"]*)" title="View details: [^"]*">(?P<name>.*)</a>.*'.
'href="download\.php(?P<link>[^"]*)">.*'.
'<td align="center" class="header" width="85">(?P<date>.*)</td>.*'.
'<td align="center" class="header" width="30">(?P<seeds>.*)</td>.*'.
'<td align="center" class="header" width="30">(?P<leech>.*)</td>.*'.
'<td align="center" class="header" width="55"><b>(?P<size>.*)</b></td>'.
'`siU', $cli->results, $matches);
if($res)
{
for($i=0; $i<$res; $i++)
{
$link = $url."/download.php".$matches["link"][$i];
if(!array_key_exists($link,$ret))
{
$item = $this->getNewEntry();
$item["cat"] = self::removeTags($matches["cat"][$i]);
$item["desc"] = $url."/index.php?page=torrent-details&id=".$matches["id"][$i];
$item["name"] = self::removeTags($matches["name"][$i]);
$item["size"] = self::formatSize(trim(str_replace("<br>"," ",$matches["size"][$i])));
$item["time"] = strtotime(self::removeTags(trim(str_replace("<br />"," ",str_replace("/",".",$matches["date"][$i])))));
$item["seeds"] = intval(trim(self::removeTags($matches["seeds"][$i])));
$item["peers"] = intval(trim(self::removeTags($matches["leech"][$i])));
$ret[$link] = $item;
$added++;
if($added>=$limit)
return;
}
}
}
else
break;
}
}
}
This is the link that should be performed by the $cli variable.
Code:
http://mysite.com/index.php?page=torrents&active=0&category=1&search=iron&&order=2&by=1
Here is the code that should be searched for in the page source.
Code:
<td align="center" width="85" class="lista" style="white-space:wrap; text-align:center;">10/10/2012</td>
<td align="center" width="30" class="lista" style="text-align: center;"><a href="index.php?page=peers&id=cf50e741392b28ab86b111e03c2df18bd69a7aea" title="Click here to view peers details">2</a></td>
<td align="center" width="30" class="lista" style="text-align: center;"><a href="index.php?page=peers&id=cf50e741392b28ab86b111e03c2df18bd69a7aea" title="Click here to view peers details">0</a></td>
<td align="center" width="30" class="lista" style="text-align: center;"><a href="index.php?page=torrent_history&id=cf50e741392b28ab86b111e03c2df18bd69a7aea" title="History - Tetsuo.The.Iron.Man.1989.720p.BluRay.x264-CiNEFiLE">5</a></td>
<td align="center" width="30" class="lista"><a href='index.php?page=userdetails&id=000'><span style='color:#DFFFFF'>someuser</a></td>