Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $username = 'YOUR_LOGIN_HERE';
- $password = 'YOUR_PASSWORD_HERE';
- $loginUrl = 'https://stat.trifle.net/login';
- // LOGIN
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $loginUrl);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, 'user='.$username.'&pass='.$password);
- curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $store = curl_exec($ch);
- // GET CONTENT
- curl_setopt($ch, CURLOPT_URL, 'https://stat.trifle.net');
- $content = curl_exec($ch);
- curl_close($ch);
- // PARSE
- $html = str_get_html($content)
- $summary = $html->find('div[class=summary]', 0)
- $result = '0';
- foreach ($summary->find('td[class=odd fon_negative]') as $tds) {
- if(isset($tds)) {
- $bold = $tds->find('b');
- if(isset($bold)) {
- $result = $bold->plaintext;
- }
- }
- }
- // PHP SCRIPT
- $status = 'default';
- if ((intval($result) > -8097) && (intval($result) < 0)) {
- $status = 'good';
- }
- elseif ((intval($result) < -8097) && (intval($result) > -9299)) {
- $status = 'warning';
- }
- elseif ((intval($result) < -9299) && (intval($result) > -9900)) {
- $status = 'danger';
- }
- elseif (intval($result) == 0) {
- $status = 'default';
- }
- $balance = sprintf("<div id='message' class='msg-%s'>%s</div>\n", $status, $result);
Add Comment
Please, Sign In to add comment