It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
if(false && $maxpageval>10)
{echo "Sorry max posts allowed is 200";die;}
if($maxpageval>10)
{echo "Sorry max posts allowed is 200";die;}
error_reporting(E_ERROR | E_PARSE);
ini_set('max_execution_time', 1200); //set at 20 minutes
date_default_timezone_set("UTC");
?>BitcoinTalk User Potential Activity Calculator
/* ****HELP***
>Place this(get_activity.php) file and simple_html_dom.php file in the same folder to get this running.
>Ensure that the server allows the script to run for long periods of time. It is set to 20 min in line 2 which should be good for around 12K posts for delay set at 2 seconds.
>Min allowed delay between access for bitcointalk.com is 1 second,but to be safe it is set at 2 seconds at line 107 for this script.
>In case of any issue or another script requirement you can PM ak111in at bitcointalk or email [email protected]
>Demo : http://www.satoshiquiz.com/bitcointalk/getactivity.php
*/
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
include_once('simple_html_dom.php');
$userid=test_input($_POST["userid"]);
$url="https://bitcointalk.org/index.php?action=profile;u=$userid;sa=showPosts";
$opts = array('http' => array('header' => "User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36\r\n"));
$context = stream_context_create($opts);
$html = file_get_html($url, FALSE, $context);
if($html=="")
{
echo "Cannot connect";
die;
}
else
{
//read all posts
ob_end_flush();
ob_start();
$postcontent=$html->find('#bodyarea',0);
if($postcontent=="")
{echo "Cannot connect";die;}
//get total pages
$pagescontent=$postcontent->find('table',0);
$pagesrow=$pagescontent->find('.catbg3',0);
$pageslist=preg_match('/Pages:.*?<\/td>/', $pagesrow, $matches);
$pageslist=preg_replace('/.*?<\/span>/','',($matches[0]));
$pageslist=trim( preg_replace('/[^\d. ]/','',strip_tags($pageslist)));
$maxpage=explode(" ",$pageslist);
$temppages=array_values($maxpage);
$maxpageval=end($temppages);
//Can be used to set limit on total posts allowed
if(false && $maxpageval>10)
{echo "Sorry max posts allowed is 200";die;}
//for everypage get all posts
$timestamps=array();$k=0;
echo "
Loading page : ";
$topics=array();
for($i=0;$i < $maxpageval;$i++)
{
echo ($i+1).",";
if(($i+1)%50==0) echo "
";
ob_flush();
flush();
$allposts=$postcontent->find('table',0)->find('tbody tr td',0)->children();
for($j=1;$j<sizeof($allposts)-1;$j++)
{
$temptimestamp=trim(strip_tags(preg_replace('/on:/','',$allposts[$j]->find('.titlebg2',0)->find('.middletext',-1))));
if (strpos($temptimestamp,'Today') !== false) {
$temptimestamp=preg_replace('/Today at/',date('F j, Y,'),$temptimestamp);
}
$timestamp=strtotime($temptimestamp);
$timestamps[$k]=$timestamp;
$k++;
preg_match('/.*\//', strip_tags($allposts[$j]->find('.titlebg2',0)->find('td',1)), $tmatches);
if(!array_key_exists("$tmatches[0]", $topics))
{$topics["$tmatches[0]"]=1;}
else
{$topics["$tmatches[0]"]=$topics["$tmatches[0]"]+1;}
}
//Can be reduced to 1 second currently set at 2 seconds
sleep(2);
$pageid=($i+1)*20;
$url="https://bitcointalk.org/index.php?action=profile;u=$userid;sa=showPosts;start=$pageid";
$context = stream_context_create($opts);
$html = file_get_html($url, FALSE, $context);
if($html=="")
{echo "Cannot connect";die;}
$postcontent=$html->find('#bodyarea',0);
if($postcontent=="")
{echo "Cannot connect";die;}
}
echo "
Total Posts=".sizeof($timestamps);
//count activity
$basetime=strtotime("8/4/2015 12:06:40");
$weekduration=1210000;
//get starting range value
$temptimestamps=array_values($timestamps);
$mintime=end($temptimestamps);
if($mintime<=$basetime)
$startingtime=$basetime-$weekduration*ceil(($basetime-$mintime)/$weekduration);
else
$startingtime=$basetime+$weekduration*floor(($basetime-$mintime)/$weekduration);
$rstart=$startingtime;
$rend=$rstart+$weekduration;
sort($timestamps);$p=0;$rangecount=array();
foreach ($timestamps as $ts)
{
if($ts>$rend)
{
while($ts>$rend)
{
$rstart=$rstart+$weekduration;
$rend=$rend+$weekduration;
}
}
if($ts<=$rend)
{
$rstartkey=date("F j, Y, g:i a",$rstart);
$rendkey=date("F j, Y, g:i a",$rend);
if(!array_key_exists("$rstartkey to $rendkey", $rangecount))
{$rangecount["$rstartkey to $rendkey"]=1;}
else
{$rangecount["$rstartkey to $rendkey"]=$rangecount["$rstartkey to $rendkey"]+1;}
}
}
echo "
";
foreach ($rangecount as $key => $value) {
echo "$key : $value
";
}
//calculate activity
$potentialactivity=sizeof($rangecount)*14;
echo "
Potential Activity=$potentialactivity";
echo "
Topic Analysis
";
foreach ($topics as $key => $value) {
echo "$key : $value
";
}
}
}
function test_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data, ENT_QUOTES);
return $data;
}
?>