Created
June 6, 2019 12:01
-
-
Save daslicht/208dec0bf6d9c4a75b702c10d302f530 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$api = "https://api.steemit.com"; | |
function GetData( $api, $pdata ) | |
{ | |
$ch = curl_init($api); // steemit api | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLINFO_HEADER_OUT, true); | |
curl_setopt($ch, CURLOPT_POST, true); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $pdata); //post data | |
curl_setopt($ch, CURLOPT_HTTPHEADER, false); // http header request | |
$data = curl_exec($ch);//get data from steemit API | |
curl_close($ch); //close curl | |
$arr = json_decode($data,true); //decode data | |
$info = $arr['result']; //select result array from JSON | |
return $info; | |
} | |
//get_account_count.php | |
require('functions.php'); //include steemTools Library function | |
$array = array('jsonrpc' => '2.0','method' => 'condenser_api.get_account_count','params' =>[],'id' =>'1'); | |
// create array | |
$post = json_encode($array, JSON_PRETTY_PRINT); // encode php array to JSON | |
$result = GetData($api,$post); // Get Data function | |
//var_dump($result);die; | |
$total = array('total_account' => $result); | |
$json = json_encode($total, JSON_PRETTY_PRINT); // encode php array to JSON | |
header("Access-Control-Allow-Origin: *"); header('Content-Type: application/json'); | |
echo $json; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment