Steemit Pending Payouts Checker PHP

odl(54)
Published in
#utopian-io
Words
241
Reading
2 min
Listen
Play
9y

Hello there

Today I am making up for introducing a project I wrote for Steemit.

To briefly explain the purpose of the project:
A web project that shows your account's pending payments.

You can see the total amount to be paid with this project written with SteemJS Api support.

So you will not have to constantly calculate.

I think this project using PHP and HTML will be of great benefit to Steemit users.


There are 3 files in the project.

3.png

-index.php

-result.php

-logo.png


https://github.com/oguzdelioglu/Steemit-Pending-Payouts-Checker-PHP


Index.php

The form page used to enter the user data the user wants to query.

1.png


result.php


The results page showing the user's outstanding payments using the SteemJS API system.

2.png


logo.png


The Steemit Platform's Logo.

Codes

Index.php

<html>
<body>
<center>
<img width="400" height="200" src="logo.png" alt="Steemit">
<form action="result.php">
  Your Steemit Account Name<br>
  <input type="text" style="text-align:center;" name="username" value="odl">
  <br> <br>
  <input type="submit" value="Check Pending Payouts">
</form> 
</center>
</body>
</html>

Result.php

<?php
$username = $_GET["username"];
$url = 'https://api.steemjs.com/get_discussions_by_blog?query={"tag":"'.$username.'","limit":"100"}';
$json= file_get_contents($url);
$data = json_decode($json,true);
echo '<style>
a {
  text-decoration:none;
}
a:visited {
    color: darkgreen;
}
</style>';

echo '<body link="darkgreen">';
echo '<meta name="viewport" content="width=device-width, initial-scale=1">';
echo '<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">';
echo '<center><a href="index.php">
<img border="0" alt="Steemit" src="logo.png" width="400" height="200">
</a></center>';
echo '<div class="w3-container">';
echo '<table class="w3-table w3-striped w3-border" align="center">';
$total_price = 0;
foreach ($data as $item) {
    try
    {
        if(!($item["pending_payout_value"]=="0.000 SBD"))
        {
            echo "<tr>";
            $post_link = "https://www.steemit.com/@".$item["author"]."/".$item["permlink"];
            $post_title = $item["title"];
            $price = str_replace(" SBD", "", $item["pending_payout_value"]);
            $total_price = $total_price + $price;
            echo '<td><a target="_BLANK" href="'.$post_link.'"/>'.$post_title.'</td> <td>'.$item["pending_payout_value"].'</td>';
            echo "</tr>";
            wait(0.1);
        }
    }
    catch(Exception $e)
    {
    }
}
echo '<center>Total SBD:'.$total_price.'</center>';
echo '</table>';
echo '</div>';
echo '</body>';

function wait($time)
{
    usleep(1000000*$time);
    ob_flush();
    flush();
}
?>

If you have ideas or suggestions about the project, you can specify it as a comment.



Posted on Utopian.io - Rewarding Open Source Contributors

Steemit Pending Payouts Checker PHP | Ecency