Get Reviews from via JSON with OAuth in PHP

This will work only if you have a seller account with

Store this command in a file named (Replace CLIENT_ID and CLIENT_SECRET with your values available in your ResellerRatings dashboard)

curl --data "grant_type=client_credentials&client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET>" > token.json

CLIENT_ID: Your Client ID as assigned in the Portal
CLIENT_SECRET: Your Client Secret as assigned in the Portal

Now run this reviews.php file in your browser :

$json = getJSONData(<SELLER_ID>); # Replace <SELLER_ID> with your seller ID

if (isset($json->status_code))
    if ($json->status_code == 401)
        $json = getJSONData();

$count = 0;

for ($i = 0; $i < count($json->data); $i++)
    if (!($json->data[$i]->rating == 4 || $json->data[$i]->rating == 5)) continue;


    echo "<b>User</b> : ".$json->data[$i]->username; echo "<br/>";
    echo "<b>Title</b> : ".$json->data[$i]->title; echo "<br/>";
    echo "<b>Review</b> : ".$json->data[$i]->review; echo "<br/>";
    echo "<b>Rating</b> : ".$json->data[$i]->rating; echo "<br/>";
    echo "<hr/>";    

    if ($count == 10) break;


function getJSONData($seller)
    $content = file_get_contents('token.json');
    $json_content = json_decode($content);
    $access_token = $json_content->access_token;

    $ch = curl_init("$seller/reviews?perPage=30");
    curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer $access_token"]);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $output = curl_exec($ch);

    return json_decode($output);    

There's a list of operations you can do with ResellerRatings API - here's the doc of all operations :